mongorestore --drop --db appdb /backups/mongo/appdb

Category: Databases & SQL

mongorestore --drop --db appdb /backups/mongo/appdb

Restore and replace existing collections

Loads the BSON files back into appdb; --drop removes each collection before restoring it, so the target mirrors the backup exactly. Destructive to current data, so verify the target database first. Omit --drop to merge.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.