导出collection
bin/mongoexport -h dbhost -d dbname -c collectionName -o output
导入collection
bin/mongoimport -h dbhost -d dbname -c collectionname inputfile
bin/mongoimport -h 127.0.0.1:17017 -d database -c collect /home/xxx/xxx.json
导出库
bin/mongodump -h <hostname><:port> -d dbname -o dbdirectory
bin/mongodump -h 127.0.0.1:37017 -d bmers_xxx -o bks/bmers_xxx
导入库
mongorestore -h <hostname><:port> -d dbname <path>
bin/mongorestore -h 127.0.0.1:17017 -d dbname /data
重命名库
db.runCommand({renameCollection:"yourdbname.yourcollection", to:"newdbname.yourcollection"})
网友评论