2

I have dumped a database from a server using mongodump - the version of mongodb used here is 2.4.

To restore the dump into the latest 3.6.5 mongoDb instance I used the command mongorestore --drop -d database dumpFolder

I got the error: Failed: myDb.collectx: error creating collection myDb.collectx: error running create command: BSON field 'OperationSessionInfo.create' is a duplicate field

1 Answer 1

2

I'm hitting the same thing, and found some detail in an answer on a related site: https://dba.stackexchange.com/questions/201827/failed-to-import-a-mongodb-database-with-duplicate-fields

What I've gathered is that mongodump version 2.2 and later is incompatible with earlier versions of MongoD - so check the version you used to dump the data.

I was able to use bsondump my_collection.bson to get a JSON dump output of the details, so I suspect I can load it from that, even though it's not recommended.

UPDATE:

I was able to use bsondump and mongoimport together with the raw BSON file to get the data loaded:

bsondump my_collection.bson > my_collection.json mongoimport -d my_db -c my_collection my_collection.json 

So a tad inelegant, but I was able to load up the MongoDB 2.4 data into a MongoDB 3.6.5 instance locally.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.