Skip to content

Instantly share code, notes, and snippets.

@steamonimo
Last active April 28, 2021 18:29
Show Gist options
  • Save steamonimo/5b66d2f493641009c8e8a17429f9a4ea to your computer and use it in GitHub Desktop.
Save steamonimo/5b66d2f493641009c8e8a17429f9a4ea to your computer and use it in GitHub Desktop.
MongoDB: commands

MongoDB: shell commands

Restore to new or existing database

mongorestore --db NewDatabase FolderOfOldDatabaseDump Note: if the database does exist then the data will be partially overwritten

Restore to existing database and delete it before

mongorestore --drop --db ExistingDatabase FolderOfOldDatabaseDump

Restore single collection to database

mongorestore --db ExistingDatabase --collection FolderOfOldDataseDump/CollectionFile.bson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment