Importing Mongo Dump By Using mongorestore

by Devansh

Posted on 22 Aug 2018 07:08:01 (1 year ago)

For importing a mongodump from folder there are simple commands which can be use to restore all the dumps in the mongo server. You can use any of below three commands according to your need.

1. For importing a .bson file:

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

2. For importing a single collection:

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

3. For restoring the complete folder exported by mongodump:

mongorestore -d db_name /path/