Recently I made a db dump on a MongoDB 2.4 server like this:
mongodump --db veye_dev
And I tried to restore it on a MongoDB 2.6 server like this:
mongorestore dump/veye_dev
Unfortunately at some point the restore process failed with this error message:
mongo error: "Btree::insert: key too large to index, failing
There are some restrictions for the size of the index in MongoDB 2.6. Luckily I found the issue on MongoDBs ticket system. The import can succeed if the mongod process is running with the parameter “failIndexKeyTooLong=false”. Just start it like that:
sudo mongod --setParameter failIndexKeyTooLong=false
And now execute the mongorestore again. That worked for me.
This just bit me too. I also discovered that you can set that flag on a running mongod instance, with:
db.getSiblingDB(‘admin’).runCommand( { setParameter: 1, failIndexKeyTooLong: false } )
Thanks for the hint. That’s useful. I had to restart my MongoDB instance.
Thanks for your article, this save me a lot of time.
thanks for such nice answer. Worked for me.
you should also note that this document won’t show up on searches anymore
you should also not that , those documents are not indexed and they won’t show up on searches
Thanks for article. but, Non-indexed data is not the search. What should I do?