I am trying to get a dump of a specific collection from my database. In mac, I am running the following command:
/usr/local/bin/mongodump --uri <connection_string> --db admin --collection tenants
and it works perfectly well.
However, when I try to run the same command in ubuntu, I get the following error:
error parsing command line options: illegal argument combination: cannot specify --db and --uri
I tried to add the /dbname suffix to the connection string but then I am not able to download a single collection as it fails with the error Failed: bad option: cannot dump a collection without a specified database
Replacing --uri with --host seems like another possible solution but that does not work for me since I only have the connection string and do not have access to the username and password.
Another weird thing I noticed is that in mac, the command mongodump --version
returns:
MongoDB shell version v5.0.6
Build Info: {
"version": "5.0.6",
"gitVersion": "212a8dbb47f07427dae194a9c75baec1d81d9259",
"modules": [],
"allocator": "system",
"environment": {
"distarch": "x86_64",
"target_arch": "x86_64"
}
}
However, in ubuntu I am seeing mongodump version: built-without-version-string
.
How do I get a dump of a single collection using connection string on Ubuntu?
Copyright Notice:Content Author:「Pradeep Vairamani」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/71790291/mongodump-mac-vs-ubuntu