mongodump

How to use mongodump for 1 collection

别等时光非礼了梦想. 提交于 2019-12-03 00:37:26
问题 How can I use mongodump to move a single collection from one database to another? How should I use the command and its options? 回答1: I think it's just: mongodump --db=<old_db_name> --collection=<collection_name> --out=data/ mongorestore --db=<new_db_name> --collection=<collection_name> data/<db_name>/<collection_name>.bson Also see docs here and here. Btw, the other way to move the collection from one database to another is to use renameCollection : db.runCommand({renameCollection:"<old_db

MongoDb: How to import dump data from .gz file?

故事扮演 提交于 2019-12-01 04:02:19
I want to import dump data from my .gz file. Location of file is home/Alex/Documents/Abc/dump.gz and the name of db is "Alex" . I have tried mongorestore --gzip --db "Alex" /home/Alex/Documents/Abc/dump.gz But it shows error: 2018-10-31T12:54:58.359+0530 the --db and --collection args should only be used when restoring from a BSON file. Other uses are deprecated and will not exist in the future; use --nsInclude instead 2018-10-31T12:54:58.359+0530 Failed: file /home/Alex/Documents/Abc/dump.gz does not have .bson extension. How can I import it? Dump command: mongodump --host localhost:27017 -

MongoDb: How to import dump data from .gz file?

不打扰是莪最后的温柔 提交于 2019-12-01 01:21:38
问题 I want to import dump data from my .gz file. Location of file is home/Alex/Documents/Abc/dump.gz and the name of db is "Alex" . I have tried mongorestore --gzip --db "Alex" /home/Alex/Documents/Abc/dump.gz But it shows error: 2018-10-31T12:54:58.359+0530 the --db and --collection args should only be used when restoring from a BSON file. Other uses are deprecated and will not exist in the future; use --nsInclude instead 2018-10-31T12:54:58.359+0530 Failed: file /home/Alex/Documents/Abc/dump.gz

MongoDB dump from 3.2, restore with 3.4, error index safe = null

Deadly 提交于 2019-11-30 12:43:28
问题 I get the following error (dump MongoDB 3.2) (restore MongoDB 3.4): Failed: ngivr-dev.ledgerhelpers: error creating indexes for ngivr-dev.ledgerhelpers: **createIndex error:** **The field 'safe' is not valid for an index specification.** Specification: **{ unique: true, name: "ledgerId_1", safe: null, ns: "ngivr-dev.ledgerhelpers", background: true, key: { ledgerId: 1 } }** Looks like the safe index is null. But how can i use it with MongoDB 3.4? 3.2 is ok. 回答1: safe=true is not an index

MongoDB dump from 3.2, restore with 3.4, error index safe = null

时间秒杀一切 提交于 2019-11-30 02:57:33
I get the following error (dump MongoDB 3.2) (restore MongoDB 3.4): Failed: ngivr-dev.ledgerhelpers: error creating indexes for ngivr-dev.ledgerhelpers: **createIndex error:** **The field 'safe' is not valid for an index specification.** Specification: **{ unique: true, name: "ledgerId_1", safe: null, ns: "ngivr-dev.ledgerhelpers", background: true, key: { ledgerId: 1 } }** Looks like the safe index is null. But how can i use it with MongoDB 3.4? 3.2 is ok. safe=true is not an index specification. In previous versions of MongoDB, lower than 3.4, extra indexes specifications can be added. Those

Mongorestore, from meteor production server to local

混江龙づ霸主 提交于 2019-11-28 19:19:31
I've found plenty of good instructions on how to use mongodump and mongorestore, to back up my meteor production server and restore the backup if need be: meteor mongo --url myApp.meteor.com mongodump -u client -h production-db-b2.meteor.io:27017 -d myApp_meteor_com -out dump/2014_10_21 -p [password from meteor mongo --url] mongorestore -u client -h production-db-b2.meteor.io:27017 -d myApp_meteor_com dump/2014_10_21_v2/myApp_meteor_com -p [password from meteor mongo --url] What I haven't found is an explanation of is how to restore a backup-dump to my local meteor app. I have a mongodump

MongoDB mongorestore failure: locale::facet::_S_create_c_locale name not valid

白昼怎懂夜的黑 提交于 2019-11-28 02:48:11
I created a dump with mongodump on computer A (ubuntu 12.04 server). I moved it to computer B (ubuntu 12.04 server) and typed: mongorestore -db db_name --drop db_dump_path It failed and it reported: connected to: 127.0.0.1 terminate called after throwing an instance of 'std::runtime_error' what(): locale::facet::_S_create_c_locale name not valid Aborted I've successfully accomplished this operation before and this strange behavior has never occurred. What do I need to do to fix this? On my distro "locale-gen" was not installed and it turned out all I had to do is set the LC_ALL environment

How to use the dumped data by mongodump?

a 夏天 提交于 2019-11-27 17:47:28
I have used mongodump to dump my database of mongodb, it created some bson files under dump/mydb But I don't know how to use them. I tried mongoimport , but seems it can't import bson data. Then how to use these bson files? How to import them to another mongodb? Justin Jenkins You need to use mongorestore , not mongoimport ... which is used for things like importing json, or csv, etc. From the back-up-with-mongodump docs: mongodump reads data from a MongoDB database and creates high fidelity BSON files which the mongorestore tool can use to populate a MongoDB database. mongodump and

Mongorestore, from meteor production server to local

▼魔方 西西 提交于 2019-11-27 12:11:09
问题 I've found plenty of good instructions on how to use mongodump and mongorestore, to back up my meteor production server and restore the backup if need be: meteor mongo --url myApp.meteor.com mongodump -u client -h production-db-b2.meteor.io:27017 -d myApp_meteor_com -out dump/2014_10_21 -p [password from meteor mongo --url] mongorestore -u client -h production-db-b2.meteor.io:27017 -d myApp_meteor_com dump/2014_10_21_v2/myApp_meteor_com -p [password from meteor mongo --url] What I haven't

MongoDB mongorestore failure: locale::facet::_S_create_c_locale name not valid

蹲街弑〆低调 提交于 2019-11-27 04:58:53
问题 I created a dump with mongodump on computer A (ubuntu 12.04 server). I moved it to computer B (ubuntu 12.04 server) and typed: mongorestore -db db_name --drop db_dump_path It failed and it reported: connected to: 127.0.0.1 terminate called after throwing an instance of 'std::runtime_error' what(): locale::facet::_S_create_c_locale name not valid Aborted I've successfully accomplished this operation before and this strange behavior has never occurred. What do I need to do to fix this? 回答1: On