mongodb将数据转储到另一个目录
我知道我可以使用此公用程序转储数据mongodb将数据转储到另一个目录,mongodb,Mongodb,我知道我可以使用此公用程序转储数据 mongodump --db mydb 此命令将所有mydb集合数据转储到./dump/mydb。但我想将数据转储到我命名的另一个目录(比如/home/user/mydb) 我已经尝试了--dbpath和--directoryperdb选项,但它似乎不是我想要的 有办法做到这一点吗 ./mongodump——救命 将MongoDB数据导出到BSON文件 选项: --help produce help message
mongodump --db mydb
此命令将所有mydb集合数据转储到./dump/mydb。但我想将数据转储到我命名的另一个目录(比如/home/user/mydb)
我已经尝试了--dbpath和--directoryperdb选项,但它似乎不是我想要的
有办法做到这一点吗
./mongodump——救命
将MongoDB数据导出到BSON文件
选项:
--help produce help message
-v [ --verbose ] be more verbose (include multiple times for more
verbosity e.g. -vvvvv)
--version print the program's version and exit
-h [ --host ] arg mongo host to connect to ( <set name>/s1,s2 for
sets)
--port arg server port. Can also use --host hostname:port
--ipv6 enable IPv6 support (disabled by default)
-u [ --username ] arg username
-p [ --password ] arg password
--dbpath arg directly access mongod database files in the given
path, instead of connecting to a mongod server -
needs to lock the data directory, so cannot be used
if a mongod is currently accessing the same path
--directoryperdb if dbpath specified, each db is in a separate
directory
--journal enable journaling
-d [ --db ] arg database to use
-c [ --collection ] arg collection to use (some commands)
-o [ --out ] arg (=dump) output directory or "-" for stdout
-q [ --query ] arg json query
--oplog Use oplog for point-in-time snapshotting
--repair try to recover a crashed database
--forceTableScan force a table scan (do not use $snapshot)
--帮助生成帮助消息
-v[--verbose]更详细(包括多次以获取更多信息)
冗长(例如-VVV)
--版本打印程序的版本并退出
-要连接到的h[--host]arg mongo主机(/s1,s2用于
(套)
--端口arg服务器端口。还可以使用--host hostname:port
--ipv6启用ipv6支持(默认情况下禁用)
-u[--用户名]参数用户名
-p[--密码]参数密码
--dbpath arg直接访问给定数据库中的mongod数据库文件
路径,而不是连接到mongod服务器-
需要锁定数据目录,因此无法使用
如果mongod当前正在访问同一路径
--directoryperdb如果指定了dbpath,则每个数据库都位于单独的数据库中
目录
--日志启用日志记录
-要使用的d[--db]arg数据库
-c[--collection]要使用的参数集合(某些命令)
-o[--out]arg(=转储)输出目录或“-”表示标准输出
-q[--query]arg json查询
--oplog使用oplog进行时间点快照
--请尝试恢复崩溃的数据库
--ForceTables可以强制表扫描(不要使用$snapshot)
您想要-o选项:
-o [ --out ] arg (=dump) output directory or "-" for stdout
这将允许您指定输出的位置