我正试图从我的数据库中获得一个特定集合的转储。在mac中,我运行以下命令:
/usr/local/bin/mongodump --uri <connection_string> --db admin --collection tenants和它的工作非常好。
但是,当我试图在ubuntu中运行相同的命令时,我会得到以下错误:error parsing command line options: illegal argument combination: cannot specify --db and --uri
我尝试将/dbname后缀添加到连接字符串中,但由于错误Failed: bad option: cannot dump a collection without a specified database失败,所以无法下载单个集合。
将-uri替换为-主机似乎是另一种可能的解决方案,但这对我不起作用,因为我只有连接字符串,没有访问用户名和密码的权限。
我注意到的另一件奇怪的事情是,在mac中,命令mongodump --version返回:
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"
}
}然而,在ubuntu,我看到了mongodump version: built-without-version-string。
如何使用Ubuntu上的连接字符串获得单个集合的转储?
发布于 2022-04-08 03:51:26
看来芒果工具的安装是腐败的。
通过使用以下命令进行安装来修复它
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt-get update
sudo apt-get install -y mongodb-orghttps://stackoverflow.com/questions/71790291
复制相似问题