mongorestore fails due to invalid BSONSize

我们两清 提交于 2019-12-20 18:06:06

问题


I have a script which dumps a mongodb

mongodump --archive=$MONGODB_PATH --host $MONGODB_HOST --port $MONGODB_PORT --username $MONGODB_USER --password $MONGODB_PASS --db $MONGODB_NAME

but when I try to restore it with

mongorestore -d db_name backup/dump

it fails with:

Failed: dump_name: error restoring from backup/dump/dump_name: reading bson input: invalid BSONSize: -2120621459 bytes

I tried --batchSize=100 but it didn't solve the issue for me.

What's going wrong here?

Solution was: mongorestore --archive=backup/dump


回答1:


When you dump with --archive flag you must restore with --archive flag as well.



来源:https://stackoverflow.com/questions/42948610/mongorestore-fails-due-to-invalid-bsonsize

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!