I know this topic is old, but I think I am having a similar problem. I have been searching from a solution all over Stackoverflow

I am running a mongodump followed by a mongorestore and in 2 out of 12 collections the numbers of documents restored are way less than the number of documents on the backup. The thing is there are no errors.

Bellow is the output fot the 2 collections on the dump

2020-01-22T10:16:26.961-0300 done dumping montele.usuario (960 documents)

2020-01-22T10:29:35.268-0300 done dumping montele.negocio (86851 documents)

And now the output for the restore

2020-01-22T10:35:21.121-0300 finished restoring montele.usuario (31 documents, 0 failures) 2020-01-22T10:37:29.974-0300 finished restoring montele.negocio (26120 documents, 0 failures)

Interesting enough .... if I run the mongorestore again without dropping the db this happens (I did this to see if it would add the remaining data):

2020-01-22T11:30:41.914-0300 finished restoring montele.negocio (0 documents, 86851 failures)

With the failure code being:

E11000 duplicate key error collection: montele.negocio index: id dup key:

I hope someone can shine a light and point me in right direction.

  • What are your specific versions of mongodump, mongorestore, and MongoDB server (source and destination deployment) and what type of deployment(s) do you have (standalone, replica set, or sharded cluster)? Have you compared collection counts via the mongo shell? – Stennie Jan 23 at 4:54
  • Which Version you are using of MongoDB. – Yogesh J Jan 27 at 14:47
  • Not sure if this was the problem but I had Mongo 4.@ running on my machine and the system I was working on was mongo 3.6 I downgraded and everything fine. – Fernando Mascarenhas Jan 28 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.