Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 580
Nedudi Avatar asked Dec 06 '22 08:12

Nedudi


1 Answers

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

like image 193
Tiny Wang Avatar answered Jan 11 '23 23:01

Tiny Wang