mongorestore to documentdb error
I am testing offline migration from MongoDB to DocumentDB using mongodump/mongorestore and got the following error:
`mongorestore --username <username> --password <password> \ --uri="mongodb://my-documentdb-cluster.cluster-abcd1234.us-east-2.docdb.amazonaws.com:27017" \ –-sslCAFile rds-combined-ca-bundle.pem --db <dbname> /var/lib/mongodb/dumps/dump
2022-02-03T09:54:15.042-0500 error parsing command line options: error parsing positional arguments: provide only one polling interval in seconds and only one MongoDB connection string. Connection strings must begin with mongodb:// or mongodb+srv:// schemes 2022-02-03T09:54:15.042-0500 try 'mongorestore --help' for more information`
Where did I do wrong?
Thanks in advance!
The main reason you are seeing "error parsing positional arguments" is the first '-' in '–-sslCAFile' is actually a Unicode EN DASH.
Also, it's not clear in the original post if this is a multi-line or single line command. Use the \
character only for multi-line input.
2 other changes to make are:
- use
--host
option instead of--uri
- add
--ssl
option
The command should look like the following:
mongorestore -ssl --username <username> --password <password> \
--host="mongodb://my-documentdb-cluster.cluster-abcd1234.us-east-2.docdb.amazonaws.com:27017" \
--sslCAFile rds-combined-ca-bundle.pem --db <dbname> /var/lib/mongodb/dumps/dump
Relevant questions
Migrate or dump DocumentDB data
asked 3 years ago"Connect failed" when trying to connect to the DocumentDB cluster from AWS C9
asked 2 months agoDocumentDB 4.0 vs mongo client
asked a year agoHow to access both DocumentDB and S3 in the same Java program
asked 2 years agoHow to implement recursive query on documentDB?
asked a year agoMongoDB Atlas vs DocumentDB
asked 3 months agomongorestore to documentdb error
asked 4 months agoI would like to connect AWS DocumentDB locally to NodeJS.
asked 3 days agoWhat Username do AWS VPN Client need when using password-encrypted private key certificate?
asked 2 months agoDefault username for WordPress in LightSail
Accepted Answerasked 2 months ago