Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (50.2k points)
I want to import my database which is stored in .bson file using the mongorestore command. But when I am implementing it, it is not working. Can somebody advise me on the correct format of the mongorestore and the other basic tools for restoring the database?

2 Answers

0 votes
by (107k points)

For importing the .bson file in MongoDB, just type the following onto the mongo shell:

mongorestore -d db_name -c collection_name /path/file.bson

If there is only a single collection then refer the following code:

mongorestore --drop -d db_name -c collection_name /path/file.bson

And regarding the restoring procedure for the whole folder that is being exported by mongodump, refer the following code:

mongorestore -d db_name /path/

0 votes
by (37.3k points)

Import .bson file :

mongorestore -d db_name -c collection_name /path/file.bson

1.2k questions

2.7k answers

501 comments

693 users

Browse Categories

...