Monogrestore is always failing with E11000 error

I have dumped my mongo data using a cronjob in nodejs and I see the created gzip file in specified location however when I am trying to restore , I am always getting E11000 error

I am using the below command to restore , please let me know what I am doing wrong
mongorestore --db=ep-restoreTest --gzip --archive=easyplatter.gzip --noIndexRestore
Im using this command to restore to db with its name ep=restoreTest

Error looks like below:

2023-10-18T15:35:00.504-0300 continuing through error: E11000 duplicate key error collection: db.products index: id dup key: { _id: ObjectId(‘609ac324a46cb01f53e2e07f’) }

I have tried this way as well and Its failing too
mongorestore --nsInclude=ep-restoreTest.* --gzip --archive=easyplatter.gzip --noIndexRestore
2023-10-18T15:55:23.455-0300 preparing collections to restore from
2023-10-18T15:55:23.527-0300 0 document(s) restored successfully. 0 document(s) failed to restore.

Finally found the solution for anyone facing the similar porblem
mongorestore --nsFrom=originalDBName.* --nsTo=newRestoreDBName.* --gzip --archive=easyplatter.gzip --noIndexRestore

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.