Backup, delete and restore collections

Backup the collection

mongodump --collection=collection-name --db=database-name

Creates a directory “dump”, which contains a folder with the db name. And this director contains the backup files of the collection. With “–out=” you can specify where you want the backup to be stored.

Delete the collection

> use database-name
switched to db onews
> db.collection-name.drop()

Restore the collection

mongorestore dump/