As per MongoDB BOL Here Back Up a Database with
mongodump Exclude local Database
mongodump excludes the content of the local database in its output.
To run mongodump against a MongoDB deployment that has access control enabled, you must have privileges that grant find action for each database to back up. The built-in backup role provides the required privileges to perform backup of any and all databases.
Changed in version 3.2.1: The backup role provides additional privileges to back up the system.profile collections that exist when running with database profiling. Previously, users required an additional read access on this collection.
The mongodump utility backs up data by connecting to a running mongod or mongos instance.
The utility can create a backup for an entire server, database or collection, or can use a query to backup just part of a collection.
When you run mongodump without any arguments, the command connects to the MongoDB instance on the local system (e.g.
127.0.0.1 or localhost) on port
27017 and creates a database backup named
dump/ in the
To backup data from a mongod or mongos instance running on the same machine and on the default port of 27017, use the following command:
The data format used by
version 2.2 or later is
incompatible with earlier versions of
mongod. Do not use recent versions of
back up older data stores.
You can also specify the
--port of the
MongoDB instance that the
mongodump should connect to. For example:
mongodump --host mongodb.example.net --port 27017
To specify a different output directory, you can use the
mongodump --out /data/backup/
To limit the amount of data included in the database dump, you can specify --db and
--collection as options to
mongodump. For example:
mongodump --collection myCollection --db test
This operation creates a dump of the collection named
myCollection from the database test in a
dump/ subdirectory of the current working directory.
mongodump overwrites output files if they exist in the backup data folder. Before running the mongodump command multiple times, either ensure that you no longer need the files in the output folder (the default is the
dump/ folder) or rename the folders or files.
For further your ref Here & Here