~ 4 min read

Mongo DB backup and restore

mongodump is a tool for exporting the contents of a database as a binary file. Mongodump can export data from either mongod or mongos instances. It can also export data from standalone, replica set, and sharded cluster deployments.

usages

mongodump --user=myuser --db=mydb --password=somepass --authenticationDatabase=admin

Or with a Mongo URI:

mongodump --uri="mongodb://myuser:somepass@localhost:27107/mydb?ssl=false&authSource=admin

so if we go back to users and roles definitions for MongoDB