5

I have successfully upgraded a database from 2.4 to 4.0 using the following 3 step method: use 2.4 mongobackup on the 2.4 database delete all .json files from the outputted dump directory use 4.0 mongorestore on the remaining .bson files


2

As you said you are trying to import a MongoDB database, And you are using the MongoDB command such as mongorestore. And also as you said you have taken mongodump backup of MongoDB database , which MongoDB version is 2.4 & you are going to import that mongodump backup in MongoDB , which version is 3.6. As I would like to say here as per MongoDB BOL ...


1

Problem is in metadata.json files. You need to remove 'options' and it will work just fine. I even created small python tool to do this: from glob import glob import json for filename in sorted(glob('dump/*/*.metadata.json')): with open(filename, 'r') as f: data = json.loads(f.read()) if 'options' in data: del data['options'] ...


Only top voted, non community-wiki answers of a minimum length are eligible