MongoDB3.4 mongodump and mongorestore back up and restore bson data, mongorestorebson
Mongodump back up data to the bson File
If logon authorization is enabled for the database, you can back up the database as follows:
Mongodump-h database address (Port available, 27017 by default) -u user name-p password -- authenticationDatabase login authorization database-d name of the database to be exported-o export to the local path (such as c:/location)
If logon authorization is not enabled, remove the-u-p -- auth .. parameters. The-h parameter can be omitted for the local database and the default port number.
Mongorestore restores data to mongodb
If logon authorization is enabled for the database, it can be restored as follows
Mongorestore-h database address (Port available, 27017 by default) -u username-p password -- authenticationDatabase login authorization database-d name of the database to import data bson file in the local path (such as c:/location)
If logon authorization is not enabled, remove the-u-p -- auth .. parameters. The-h parameter can be omitted for the local database and the default port number.
Both methods are for the entire database. If you want to restore and back up only one collection and add the-c collection name