2012-09-04 15 views
0

我明白,我可以用这个共同MongoDB的转储数据到另一个目录

mongodump --db mydb 

此命令转储数据将转储mydb的集合数据./dump/mydb。不过,我想数据转储到另一个目录我命名(比如/ home/user中/ MYDB)

我试图与--dbpath和--directoryperdb选项,似乎不是我想要的

有一种方法来做到这一点?

./mongodump --help

出口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) 

回答

2

你想-o选项:

-o [ --out ] arg (=dump) output directory or "-" for stdout 

,可以让你指定输出去。

+0

它就像一个魅力。谢谢 – icn

相关问题