Company database migration, so add a bit of knowledge:
1 Import and export of collections
Command-line help Mongoexport--help
Export
Export Newsserver database under News collection
mongoexport-d newsserver-c News-o D:\data\news.json
Same as above, but specify only partial fields (Id,title)
mongoexport-d newsserver-c news-f _id,title-o D:\data\news.json
If you need user rights authentication, you need to specify the user and password,-u (--user) followed by the set user name, the password set by-p
Mongoexport-u username-p pass-d newsserver-c news-o D:\test.json
Import (if authentication is required)
If it's a JSON file,
Mongoimport-u username-p pass-d newsserver-c News--file D:\test.json
If it is a CSV file (Specify a field, you can specify the field of the collection to be imported by--fileds (-f)
Mongoimport-u username-p pass-d newsserver-c news--type csv--fields _id,from_user_id--file d:\test.csv
2 Import and export of databases
Export
Export the Newsserver database
mongodump-d Newsserver-o/home/dbbackup
If there is a validation, you need to specify a username, password
Mongodump-u username-p pass-d Newsserver-o/home/dbbackup
Export, if verification is required
Mongorestore--port 27017-u username-password=pass--drop-d newsserver/home/dbbackup/newsserver
MongoDB data Backup, restore notes