1:mongodump-h IP--port Port-u user name-p password-d database-o file exists path
If there is no user who can remove-u and-P.
If you export the native database, you can remove-H.
If it is the default port, you can remove--port.
If you want to export all databases, you can remove-D.
Export the specified database: (at this point, just export all the collections under YDKT, but no data for the collection Space time)
127.0. 0.1 -D ydkt-o/tmp/mongdb-tmp
2:mongorestore Restoring a Database
Mongorestore-h IP--port Port-u user name-p password-d database--drop file exists path
To restore the specified database:
[Email protected]:mongo-tmp# mongorestore-d ydkt ydkt/
3:mongoexport Export a table, or some field in a table
Mongoexport-h IP--port Port-u user name-p password-D database-C table name-F field-Q conditional export--csv-o file name
To export an entire sheet:
[Email protected]:mongodb# mongoexport-d ydkt-c bjs-o/tmp/mongdb-tmp/127.0. 0.1 1 Records
4:mongoimport Import Collection (table), or partial fields in a table
[Email protected]:ydkt-c# mongoimport-d ydkt-c BJS--20t11:: 58.051+0800 connected to:localhost- -20t11:: 58.054+0800 1 document[email protected]:ydkt
Mongodump backing up the database