patternCritical
How restore a specific database from backup using mongorestore command
Viewed 0 times
howmongorestoredatabaseusingspecificcommandfromrestorebackup
Problem
I created a backup of all my databases using mongodump command. Now I want to restore a specific database using mongorestore command.
How is this possible, I use this command: --db option then mongodb doesn't restore a specific database.
How is this possible, I use this command: --db option then mongodb doesn't restore a specific database.
Solution
To restore a single database you need to provide the path to the dump directory as part of the
For example:
The
The
mongorestore command line.For example:
# Backup the training database
mongodump --db training
# Restore the training database to a new database called training2
mongorestore --db training2 dump/trainingThe
--db option for mongodump specifies the source database to dump.The
--db option for mongorestore specifies the target database to restore into.Code Snippets
# Backup the training database
mongodump --db training
# Restore the training database to a new database called training2
mongorestore --db training2 dump/trainingContext
StackExchange Database Administrators Q#113017, answer score: 103
Revisions (0)
No revisions yet.