MongoDB: mongorestore invalid object size

I had to take a back up of a collection few months back, and dumped the data in to a file with name backup.json. Today i tried to use mongorestore to put the data back in to the database only to realise that it’s not possible and was getting the error ..

“invalid object size”.

After searching on the internet and thanks to SO, i found that i have used mongoexport to take a dump of the back up file and can import the data back to database only using mongoimport.

So use

mongoimport if you have exported data using mongoexport

mongorestore if you have exported data using mongodump

Happy Coding..

Advertisements