Mongodump mac vs ubuntu



我正试图从数据库中获取特定集合的转储。在mac中,我运行以下命令:

CCD_ 1,工作良好。

然而,当我尝试在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替换为--host似乎是另一种可能的解决方案,但这对我来说不起作用,因为我只有连接字符串,无法访问用户名和密码。

我注意到的另一件奇怪的事情是,在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上使用连接字符串获得单个集合的转储?

看起来mongo工具的安装已损坏。

通过使用以下命令安装修复了它

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-org

最新更新