从本地主机到 cosmosDb 的 Mongorestore 失败,并显示“通过指定“retrywrites=false”禁用可重试写入

Ned*_*udi 4 mongodb azure-cosmosdb azure-cosmosdb-mongoapi

mongo 客户端 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.
Run Code Online (Sandbox Code Playgroud)

我试过另一种方式

mongorestore "mongodb://<host>:<password>@<name>:10255/?ssl=true&retrywrites=false&appName=@name@" dump/
Run Code Online (Sandbox Code Playgroud)

有同样的错误。

Tin*_*ang 12

我发现这个命令 --writeConcern="{w:0}"可以解决“rewrite=false”错误。我已经试过了,这是我的命令。

mongorestore.exe --uri "<cosmosdb_connect_string>" --db Database1 --collection collection1 --ssl --sslAllowInvalidCertificates edx-dump/Database1/collection1.bson --writeConcern {w:0}
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明