What command do I use and run?
cmd -->
C:\Program Files\MongoDB\Server\3.2\bin>mongodump.exe --db Dintest
You need to open command prompt as an administrator in a folder where your Mongo is installed (in my case: C:\Program Files\MongoDB\Server\3.4\bin). If you want to dump your whole database, you can just use:
mongodump --db database_name
You also have posibilities to dump only certain collection(s), or to dump all but certain collection(s).
If you want to dump only one collection (for example users):
mongodump --db database_name --collection users
If you want to dump all but users collection:
mongodump --db database_name --excludeCollection=users
It is also possible to output the dump to an archive file:
mongodump --archive=test.archive --db database_name
To dump your database for backup you call this command on your terminal
mongodump --db database_name --collection collection_name
To import your backup file to mongodb you can use the following command on your terminal
mongorestore --db database_name path_to_bson_file
Below command will work to take dump of mongo db .
mongodump -d -o
On Windows : try this one where c:\mongodump is dump file location , It will create metadata in json, and backup in bson format
C:\MongoDB\bin>mongodump -d -o c:\mongodump
If your database in the local system. Then you type the below command. for Linux terminal
mongodump -h SERVER_NAME:PORT -d DATABASE_NAME
If database user and password are there then you below code.
mongodump -h SERVER_NAME:PORT -d DATABASE_NAME -u DATABASE_USER -p PASSWORD
This worked very well in my Linux terminal.
Use -v to see progress of backup data
mongodump -v --db dbname --out /pathforbackup/NewFolderforBackupData
you can use it for restore also
mongorestore -v --db dbname --drop /pathforbackup/NewFolderforBackupData/dbname
with multile v like -vvvv you will get more information