Questions tagged [mongodump]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
241 views

Using mongodump to dump all databases but exclude a collection

The mongodump tool seems not to support the option --excludeCollection=someCollection when not specifying the --db someDb option. We would like to dump just all databases without explicitly specifying ...
user avatar
  • 111
0 votes
1 answer
179 views

Can't restore `mongodump` archivegz file with `mongorestore`

I generated a MongoDB dump file with the archivegz format. When I try to restore it with the mongorestore command, it won't restore. The command for restore mongorestore --gzip --archive="./...
user avatar
  • 101
0 votes
0 answers
30 views

Mongodump with 2 queries

I have two queries: var idsList = db.getCollection("collectionA").aggregate([{ $match: { createDate: { $gte: new Date("2022-01-01T00:00:00"), $lt: new Date("2022-...
user avatar
0 votes
0 answers
54 views

MongoDB Index Restore Failure Since I Upgraded from 4.2 to 4.4

Steps to reproduce After upgrading from 4.2 to 4.4, take backup using mongodump Now restore backup On some collections, I am getting following {"alternate":"non-ignorable", "...
user avatar
0 votes
1 answer
1k views

mongodump failing with invalid json input [closed]

mongodump failing with invalid json input mongod --version db version v3.4.1 git version: 5e103c4f5583e2566a45d740225dc250baacfbd7 OpenSSL version: OpenSSL 1.0.2n 7 Dec 2017 allocator: tcmalloc ...
user avatar
  • 94
0 votes
1 answer
653 views

Rename all databases when doing a mongorestore?

I have a datadump but I need to change the name of every database while restoring them, if a database is named "customers" it needs to be "customer2", "products" to "...
user avatar
  • 69
1 vote
1 answer
41 views

MongoDB: Queries running twice slow on NEW server compared to OLD server

I transferred current/old running DB into a new standalone server for MongoDB. To do this, I performed the following: Took dump of data from OLD server Restored data from the generated dump into NEW ...
user avatar
0 votes
1 answer
973 views

MongoDB dump oplog based on timestamp

I'm trying to dump oplog.rs from local database, based on timestamp. Query directly from mongo shell works but not from mongodump Query from mongo shell RS1:PRIMARY> db.oplog.rs.find({"ts" : {$gt ...
user avatar
  • 15
0 votes
1 answer
158 views

mongodump and restore in single command

How to perform mongo DB dump and restore in a single command, by providing source and sink DB and collection name separately? I understand we can do mongodump and then mongorestore but if I need to ...
user avatar
1 vote
2 answers
2k views

mongodump command with timestamp query

When I execute the below query in mongodb shell, it gives me the number of records updated after the mentioned timestamp. db.getCollection('oplog.rs').find({"ts":{"$gt":Timestamp(1582823397,2)}}) I ...
user avatar
0 votes
1 answer
2k views

How to use variables in a mongodump query

I want to backup data of last day (Current Day-1) every day using cron tasks. In the mongo shell, I can query the data using variables as below: var start = new Date(); start.setHours(0,0,0,0); ...
user avatar
1 vote
1 answer
668 views

Mongo: mongodump and the config database error

I've setup a backup script on my Ubuntu box using mongodump. However this currently doesn't work because of an error when attempting to dump the built in config database: (Apologies for the image, I ...
user avatar
1 vote
1 answer
2k views

mongodump fails after exactly 10 minutes

Using single instance MongoDB v4.2.0 on Debian 9.11 with collection of 78GB and 60M documents on a 2 vCPUs, 13 GB memory server. This command is invoked on the same server where database runs: ...
user avatar
  • 211
1 vote
0 answers
11 views

Mongodb - Small and Larger deployment

I read the following information from "https://docs.mongodb.com/manual/core/backups/" "mongodump and mongorestore are simple and efficient tools for backing up and restoring small MongoDB ...
user avatar
  • 11
0 votes
0 answers
399 views

Mongoexport and mongodump disk usage rationale

I just had an interesting experience with the mongoexport tool and came out with a doubt about the exporting process' disk usage. I was trying to dump a 50 MB collection to a disk that had 3 GB free ...
user avatar
0 votes
1 answer
529 views

Mongoexport halts when it reaches 101 records

I'm trying to dump a MongoDB collection from a remote server to a local JSON file. First, I do some ssh port forwarding to begin with: ssh -NL 12345:localhost:27017 $REMOTE_USERNAME@$REMOTE_HOST &...
user avatar
0 votes
2 answers
715 views

mongodump download collections only if changed

If I get it right if to make mongodump in to directory that already contains previous dumped data it will still download full collection data even if is not different from data containing in the dir ...
user avatar
80 votes
4 answers
52k views

Mongodump: Unrecognized field 'snapshot'

I am using mongodump from mongo tools to download a backup of my server. However as I run the command, the command returns "Unrecognized field 'snapshot'". The full error is: Failed: error reading ...
user avatar
  • 973
2 votes
1 answer
3k views

Mongodb _id Value and Indexes Are Lost During Mongorestore

Steps I used: mongodump copy dump folder to another computer (for each collection I get .bson and metadata files) mongorestore myDumpFolder I noticed the indexes are lost and _id has new ...
user avatar
  • 121
2 votes
1 answer
5k views

mongodump 3.4.1 error reading collection: Closed explicitly [closed]

[BACKUP COMMAND]: mongodump -u username -p password -d database --port port -o output path. [ISSUE]: error writing data for collection to disk: error reading collection: Closed explicitly. The ...
user avatar
2 votes
1 answer
838 views

Reliability of mongodump

I understand that the recommended way to backup MongoDB data is to use file system level tools. However, mongodump utility is promoted as a valid alternative for smaller instances, when file system ...
user avatar
1 vote
3 answers
5k views

Failed to import a mongodb database with duplicate fields

I'm trying to import a mongodb database and I've been using the mongorestore command, the import starts without problems until it gives the error: Failed: dbprod.mys_account: error creating collection ...
user avatar
0 votes
1 answer
559 views

mongodump sharded collection size is smaller after restoring

I need to change shard index from range to hashed in a sharded collection. So I need to mongodump and restore the collection. I have 3 shards with 3 replica sets.MongoDB version is: 3.2.11 I started ...
user avatar
4 votes
2 answers
7k views

MongoDB restore with replica set

I have MongoDB setup like this: Primary | Server1 -----------+--------- Secondary | Server2 -----------+--------- Arbiter | Server3 -----------+--------- Backup | Server4 I ...
user avatar
  • 41
15 votes
3 answers
15k views

What is difference between mongodump and mongoexport?

I know that when we have to take full backup at database & collection level we use mongodump but with mongodump we can take backup of a particular record also so what is difference between ...
user avatar
  • 173
5 votes
2 answers
24k views

MongoDB import bson files from a folder

I am unable to import (.bson) file on my computer to MongoDB database .I have been trying below commands : 1)mongorestore -d demo -c dcoll C:\data\dump\twitter\tweets.bson and 2)mongorestore -d ...
user avatar
  • 51
0 votes
1 answer
681 views

Assertion failure _state.get() error in MongoDB during mongorestore

I would like to say i am newbie in mongodb,today i have tried to restore dump file .I am getting the Assertion failure _state.get() during mongorestore dump in my mongod and process has stuck at that ...
user avatar
0 votes
1 answer
912 views

Too much memory is being used during backup

I have mongodb in ubuntu server. DB version : 3.2.8 CPU : 4 Core Memory : 16 GB Disk : 50GB Normally server memory status: Running backup script: DIR=`date +%m%d%y` DEST=DBBackup/MongoDB/$DIR ...
user avatar
  • 1,035
0 votes
1 answer
740 views

How to update collections and restore while doing mongorestore?

is there any way that i can update the collection and restore the same from dump created by mongodump cmd . when we do mongorestore , it directly restores from the dump , but my requireemnet is to ...
user avatar
0 votes
2 answers
8k views

Backing up a MongoDB cluster with mongodump?

Can anyone indicate the right way to backup a MongoDB database with mongodump? I have tried: mongodump --host "cluster0-shard-00-00-2djno.mongodb.net:27017,cluster0-shard-00-01-2djno.mongodb.net:...
user avatar
  • 225
0 votes
2 answers
1k views

mongodump: are 4 shards with total datasize 575 GB consider a Small Sharded Cluster?

I need to test the restore with Ops Manager. For this I "clone" the production sharded cluster. I create VMs with the same size like production and do mongodump/mongorestore (Ops Manager Deployment). ...
user avatar
  • 2,188
2 votes
2 answers
2k views

Unable to configure MongoDB replication without initial sync

I have a big MongoDB database on my production server, which I want to set up as a replica set. I understand that if I enable the replica set option on both servers, it will automatically start to ...
user avatar
  • 1,698