0

I am trying to export collection data from (SSL MongoDB 4.x), for this I am running below command on linux terminal. Earlier I used mongoexport command in Linux terminal without SSL which works properly for (MongoDB without SSL).

sudo mongoexport --verbose=1 --host X.X.X.X:27018 --ssl --sslCAFile "certificate.pem"  -u username -p password --authenticationDatabase XYZ_Database --collection XYZ_Collection --out Output.csv 

Error

2020-01-28T15:15:03.266+0000    could not connect to server: server selection error: server selection timeout
current topology: Type: Single
Servers:
Addr: X.X.X.X:27018, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection(X.X.X.X:27018[-121]) connection is closed
0

You are using the --sslCAFile argument, this is to specify the Certificate Authority file to be used against the server's certificate.

I think you might need to use --sslPEMKeyFile instead of --sslCAFile.
Better yet, you might need to specify them both if you are using self-signed certificates with a custom Certificate Authority.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.