Skip to content

Instantly share code, notes, and snippets.

@valorad
Last active September 21, 2019 22:33
Show Gist options
  • Save valorad/39eed8b910e19b27814169cb3178a41a to your computer and use it in GitHub Desktop.
Save valorad/39eed8b910e19b27814169cb3178a41a to your computer and use it in GitHub Desktop.
Mongo 豪华小命令
mongodump --uri "mongodb://[adminUser]:[password]@127.0.0.1:27017/[dbName]?authSource=admin" -o [path out e.g. M:\backup]
mongoimport --uri "mongodb://[adminUser]:[password]@127.0.0.1:27017/[dbName]?authSource=admin" --collection [colName] --jsonArray --file [fileName].json
mongorestore [path to restore e.g. M:\backup\hugedb] --uri "mongodb://[adminUser]:[password]@127.0.0.1:27017/[dbName]?authSource=admin"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment