我正在使用 mongodb 2.6 并尝试使用查询选项创建转储给出“不允许位置参数”。
我试图获取所有参数时间戳在指定范围之间且其 id 为任何指定格式的产品。
mongodump --host 10.xx.xxx.xx:xxxx --db test --collection products --username abc --password uvw --query '{"parameterList":{$elemMatch:{ "paramName":"TimeStamp","paramValue":{$gte:"20160620000000",$lt:"20160724000000"}}},"parameterList.paramValue": {$in:[/SPC126/,/CSC234/]}}' --authenticationDatabase test --out "c:\New folder\dump"
Run Code Online (Sandbox Code Playgroud)
文件结构
{
"_id": ObjectId("590074c362f41f15144996fa"),
"product": "device1",
"parameterList":[{"paramName":"TimeStamp",
"paramValue":"20160731000700"},
{"paramName":"Id",
"paramValue": "SPC126332"}]
}
Run Code Online (Sandbox Code Playgroud)