語法(括號中的表示是可選的):
mongodump-h host-d dbname-o directory[-port port-u username-p password-authentication database admin]
示例1(不需要認證):
mongodump -h localhost -d研究
示例2(需要認證):
mongodump-h localhost-d study-o C:users xxxdesktop-port 27017-u root-p 123456-authenticationDatabase admin
2.將所有收藏導入到庫中。
語法(括號中的表示是可選的):
mongorestore-h dbhost-d dbname dbdirectory[-port port port-u username-p password-authentication database admin]
示例1(不需要認證):
mongorestore -h localhost -d測試
示例2(需要認證):
mongorestore -h localhost -d測試C:UsersxxxDesktopstudy-port 27017-u root-p 123456-authenticationDatabase admin