1

We are trying restore documents in the dump that are not present in a collection and skip over documents in the existing collection using mongorestore.

This is how we run our restore command:

mongorestore --host localhost \
             --authenticationDatabase admin \
             -u "$MONGODB_ADMIN" \
             -p "$MONGODB_ADMIN_PASSWORD" \
             --db "$MONGODB_DATABASE" \
             $backup_dir/$base_filename/db_name

But we end up with this error when the dump contains the same documents as are present in the collection

E11000 duplicate key error collection: db_staging.events index: id dup key: { : ObjectId('5886d6bddb4d087e65111111') }

The mongorestore version I am using is r3.0.13

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.