To restore your database we’ll use mongorestore commands to restore or import our data

Import all database in a backup directory

mongorestore backup-directory

For example

mongorestore dump/

This will restore all databases located in the dump directory

Restore certain database

We’ll do the exact same thing but we need to define the database name that will be saved in:

mongorestore -d dbName path-to-db-name-directory/

This will create dbName database and import all data from the path-to-db-name-directory directory location.

mongo series1 - Run MongoDB in the background2 - Create root user in MongoDB3 - Default Config File Path4 - Create Daily Backup For MongoDB Databases5 - Default path of config file in MongoDB6 - List All Databases In MongoDB7 - Delete OR Drop Database In MongoDB8 - How to export or dump database in MongoDB9 - How Import or restore database In MongoDB10 - List all collections in database with its size11 - Delete Database Collection from database12 - Delete Database Collection documents from database