local database mainly stores metadata such as configuration information of the replica set and oplog, and the admin database mainly stores information such as users and roles. In order to prevent data disorder and authentication failures, TencentDB for MongoDB prohibits importing local and admin databases into an instance.dump and restore operations are performed.mongodump --host 10.66.187.127:27017 -u mongouser -p thepasswordA1 --authenticationDatabase=admin --db=testdb -o /data/dump_testdb

mongorestore --host 10.66.187.127:27017 -u mongouser -p thepasswordA1 --authenticationDatabase=admin --dir=/data/dump_testdb

mongoexport --host 10.66.187.127:27017 -u mongouser -p thepasswordA1 --authenticationDatabase=admin --db=testdb --collection=testcollection -o /data/export_testdb_testcollection.json
-f parameter to specify a desired field or the -q parameter to specify a query condition so as to restrict the data to be exported.mongoimport --host 10.66.187.127:27017 -u mongouser -p thepasswordA1 --authenticationDatabase=admin --db=testdb --collection=testcollection2 --file=/data/export_testdb_testcollection.json
rwuser and mongouser by default to support the MONGODB-CR and SCRAM-SHA-1 authentication methods, respectively.mongouser and all new users created in the console, follow the above directions to use the import and export tools.rwuser, the parameter --authenticationMechanism=MONGODB-CR should be included in each command.mongodump --host 10.66.187.127:27017 -u rwuser -p thepasswordA1 --authenticationDatabase=admin --authenticationMechanism=MONGODB-CR --db=testdb -o /data/dump_testdb
Feedback