–query(或-q) json字典(查询条件)
导入:
mongoimport --host 127.0.0.1 --port port -u test -p test --db test_db -c test_col --type j
son --file /home/pengkunpeng/parse_ebook/kj/res_data
导出:
mongoexport --host 127.0.0.1 --port port -u test -p test --db test_db --collection test_col --out file_path
导出:
mongoexport -h ip_address --port port -u db_username -p db_password -d db_name -c col_name -f field1,field2 -o file_path --type=file_type -q='{"test_field":{"$exists":true}}'
-h 数据库的地址
--port 端口号(两个短线
-u 数据库用户名
-p 数据库密码
-d 数据库名
-c 表名
-f 字段名(多个字段以英文逗号隔开,不能有空格
--type 输出文件类型(两个短线. json、csv
-o 输出的文件
-q 筛选条件(json字符串:外单引号内双引号