mongorestore failed with error
This is a very recent problem I faced while working on mongodb.
I took a dump at one machine with mongodump, like this:
$ mongodump -h 127.0.0.1
After moving the dump to another machine, when I tried to restore the dump using this command, I get the following error:
$ mongorestore dump Thu Oct 11 21:12:52 going into namespace [test.napster] 62502551/759743785 8% 92379177/759743785 12% 93983613/759743785 12% 104989546/759743785 13% 120874008/759743785 15% 129525355/759743785 17% got an object of size: 11994113 terminating... assertion: 10264 invalid object size
I did a lot of research, read lots of options given on few sites, but none of them really worked for me.
Later on, I figured that it might be because, the data could possibly be corrupted.
As it’s clear from the error that, the db name is “test”. Then I went back to the host from where I earlier took the dump and ran this command on the mongo prompt.
> use test > db.repairDatabase();
This will take sometime, depending on how big your database could be and how powerful your machine is. Once it’s completed, take the dump again and restore it. I am pretty sure that it will work.
Hope this helped.
If you enjoyed this post, make sure you subscribe to my RSS feed!!!!