Mongorestore from localhost to cosmosDb fails with "disable retryable writes by specifying "retrywrites=false"

3.3k views Asked by At

mongo client v 4.4

mongorestore --host <host> --port 10255 -u <user> -p <password> --db <db_name> --collection structures structures.bson --ssl --sslAllowInvalidCertificates

2020-10-03T23:13:44.440+0300    Failed: <db_name>.structures: error restoring from structures.bson: (BadValue) Retryable writes are not supported. Please disable retryable writes by specifying "retrywrites=false" in the connection string or an equivalent driver specific config.

I tried the other way

mongorestore "mongodb://<host>:<password>@<name>:10255/?ssl=true&retrywrites=false&appName=@name@" dump/

with the same error.

1

There are 1 answers

3
Tiny Wang On

I found that this command --writeConcern="{w:0}" can solve the "rewrite=false" error. I have tried it and here's my command.

mongorestore.exe --uri "<cosmosdb_connect_string>" --db Database1 --collection collection1 --ssl --sslAllowInvalidCertificates edx-dump/Database1/collection1.bson --writeConcern {w:0}

enter image description here