hi.
I had the same error for creating a new document.
I deleted the database and the error is went.
It must be a logic Error.
check you’re operator for updating the document.
this error will happen when you do a bad query to the database.
I hope to be helpful.
It looks like you may have previously restored a backup to the DATABASE_NAME_COPY namespace.
Since your current mongorestore options do not include --drop, it is expected that a restore will encounter duplicate key exceptions when documents with the same _id already exist in the target database. If you ran this mongorestore command line twice in succession, the outcome would be as per your example: all documents will already have been inserted and will fail to be restored.
If the target database definitely does not exist and you are still experiencing this behaviour, please provide some further details to try to reproduce the issue:
versions of mongodump and mongorestore used (as reported by running each with --version)
No, with every restore I change the value of DATABASE_NAME_COPY and I also tested with different databases and I keep getting the same result.
And keep in mind, I used to do this without any problem.
Here are the requested versions:
mongodump version: 100.5.0
git version: 460c7e26f65c4ce86a0b99c46a559dccaba3a07d
Go version: go1.16.3
os: linux
arch: amd64
compiler: gc
mongorestore version: 100.5.0
git version: 460c7e26f65c4ce86a0b99c46a559dccaba3a07d
Go version: go1.16.3
os: linux
arch: amd64
compiler: gc
MongoDB server version for the Atlas deployment: M0