【发布时间】:2019-12-03 15:57:26
【问题描述】:
我需要使用 mongodb export 命令提取数据
以下是我在 mongo db 上的数据结构
{
"_id": "12345",
"name": "Ebo",
"salary": NumberInt(350000),
"age": NumberInt(24)
}
{
"_id": "67891",
"name": "Amir",
"salary": NumberInt(250000),
"age": NumberInt(24)
}
我尝试在多个字段中使用导出来使用 mongoexport,下面是我要生成的命令。
mongoexport --username abc --password abcde --host mymonggodb:27017 --db school
--collection employee --type=csv --authenticationDatabase admin -c records
--query="{'_id': {$in : ['12345','67891','11121314','123456']}}" --fields _id,name,salary,age
--out /Users/axxxx/abcde/monggoextractdata/monggo_employee_data.csv
但我收到以下错误。
2019-03-07T12:32:23.460+0700 error validating settings:
query '[123 39 95 105 100 39 58 32 123 32 58 32 91 39 51 52 55 52 82 67 39 44 39
51 52 48 54 65 71 39 44 39 51 50 56 50 84 70 39 44 39 51 52 49 48 86 51 39 93
125 125]' is not valid JSON: invalid character ':'
looking for beginning of object key string 2019-03-07T12:32:23.460+0700
try 'mongoexport --help' for more information
【问题讨论】:
标签: mongodb nosql mongoexport