MongoDB several small commands

2012-10-31

 

1. Export method A

例子:mongoexport --host 127.0.0.1 --port 00000 -d db_test -c stats -q "{'key':{'\$gte':'2012-04','\$lt':'2012-05'}}" -f key,value -o ~/stats04

Explanation : The data whose value of the domain key is between 2012-04 and 2012-05 is exported. The exported data is placed in the stats04 file in the start directory. The data format only contains fields (Field) of key and value.

Note : If the -q json uses double quotes, $ needs to be escaped.

 

2. Export method B

Example : mongoimport --host 10.100.10.10 --port 27000 -d db_test -c u_stats -file ~/stats04

Explanation : Import previously exported data into another database

Note : The table names in the new database have been modified

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326940539&siteId=291194637