How to use the dumped data by mongodump?

前端 未结 6 2059
無奈伤痛
無奈伤痛 2020-12-04 15:03

I have used mongodump to dump my database of mongodb, it created some bson files under dump/mydb

But I don\'t know how to use them. I tried

6条回答
  •  旧巷少年郎
    2020-12-04 16:04

    For resolving this, I copied the dump folder,dbdump(which contains bson files) to bin directory of mongodb and executed the below commands in command prompt:

    1. cd "path to MongoDB's bin folder"
    (Example: cd C:\Program Files\MongoDB\Server\3.2\bin)

    2. mongorestore.exe --dir ./directory name --db database-name
    (Example: mongorestore --dir ./dbdump --db testdb)

    All bson files in the dump folder will be imported into your database. You can verfiy this by executing the below commands :
    cd "path to MongoDB's bin folder"
    mongo.exe
    show dbs;

提交回复
热议问题