Questions tagged [mongodump]

Mongodump is a utility for creating a binary export of the contents of a database.

Consider using this utility as part of an effective backup strategy. Use mongodump in conjunction with mongorestore to restore databases.

362 questions
103
votes
6 answers

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

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…
Luca Anceschi
  • 2,257
  • 3
  • 19
  • 24
96
votes
6 answers

How to use mongodump for 1 collection

How can I use mongodump to move a single collection from one database to another? How should I use the command and its options?
user2325703
  • 1,161
  • 1
  • 8
  • 10
77
votes
14 answers

Can't create backup mongodump with --db. Authentication failed

When I create backup of all databases in MongoDB (version 3): mongodump --username bacUser --password 12345 It's OK. But when I try to create backup of a selected db: mongodump --username bacUser --password 12345 --db test It gives me this…
Vladislav Orillo
  • 2,147
  • 2
  • 11
  • 7
70
votes
6 answers

How to use the dumped data by mongodump?

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…
Freewind
  • 193,756
  • 157
  • 432
  • 708
55
votes
5 answers

mongodump ignore some specified collections

I was trying to backup my mongo database on the product sever.and then restore then back to the staging server. and here comes some problem, there are a lot of collections in db, I want to igonre some collections that I don't want to restore on…
sashimi
  • 793
  • 2
  • 8
  • 14
34
votes
4 answers

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

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: …
Chaitanya Parashar
  • 692
  • 2
  • 12
  • 21
32
votes
5 answers

mongodb dump fails with cannot unmarshal DNS message

I am using a mongo db server version MongoDB shell version v4.0.16 installed on a EC2 instance. I am able to get into the instance using mongo command mongo mongodb+srv://dxxxxxxx:xxxxxx[][]@cluster0-vxcen.gcp.mongodb.net MongoDB shell version…
klee
  • 1,554
  • 2
  • 19
  • 31
29
votes
5 answers

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

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.**…
Patrik Laszlo
  • 4,906
  • 8
  • 24
  • 36
29
votes
4 answers

Is it possible to specify a directory/folder for mongodump?

I'd like to specify the directory to which mongodump dumps, via a switch on the mongodump command. Is this possible?
ericsoco
  • 24,913
  • 29
  • 97
  • 127
24
votes
4 answers

MongoDB restore warning

I'm following this tutorial to backup and restore a single MongoDB database. The backup command - sudo mongodump --db newdb --out /var/backups/mongobackups/`date +"%m-%d-%y"` The restore command - sudo mongorestore --db newdb --drop…
Jyotman Singh
  • 10,792
  • 8
  • 39
  • 55
23
votes
2 answers

Drop all indexes from all collections in a MongoDB database using the command line

I've used mongorestore to restore a database but I'm getting an error that the index already exists when I try to run my application. I know of the function db.collection.dropIndex() but is there a way to automate this and drop all indexes from all…
Simon
  • 1,643
  • 7
  • 30
  • 61
23
votes
6 answers

Mongorestore, from meteor production server to local

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…
Raemon
  • 411
  • 2
  • 4
  • 7
17
votes
1 answer

What is the archive format used by mongodump with "--archive" key?

Is there a way to extract data from that archive without mongorestore?
alex_1948511
  • 6,073
  • 2
  • 20
  • 21
16
votes
6 answers

After Mongodump, calling MongoRestore hangs

We are trying to do a simple MongoDump on a relatively small DB. our steps are simple: export drop exisiting DB from target machine import on target machine The MongoDump executes perfectly. mongodump --out=/root/mongo-prod The same goes for the…
Urbanleg
  • 6,252
  • 16
  • 76
  • 139
15
votes
4 answers

mongodump vs mongoexport: which is better?

I want to export very large collections and import them into another database in another server. I found there are at least two ways: mongoexport and mongodump. I searched previous posts about this issue, however I did not find a complete…
Asef Pourmasoomi
  • 464
  • 1
  • 3
  • 17
1
2 3
24 25