这是我的文件:
{
$set: {"paths.0.pathBreak" : {
"1": {
"Key1" : [66.92, 22.34],
"Key2" : "Val2",
"Key3" : [64.92, 22.34],
"Key4" : "destination : dest2",
"transportTypes" : [{
"type" : "bus",
"fare" : {
"adult" : 5.0,
"child" : 2.0,
"all" : 5.0
},
"encodedPath" : "kjfghl2h34h2l4h",
"approxTime" : "00:00:30",
"info" : "direct "
}]
}
}
}
}
当我通过mongodb shell将其分配给变量insertDoc
时:
> insertDoc={
... $set: {"paths.0.pathBreak" : {
...
... "1": {
... "Key1" : [66.92, 22.34],
... "Key2" : "Val2",
... "Key3" : [64.92, 22.34],
... "Key4" : "destination : dest2",
... "transportTypes" : [{
... "type" : "bus",
...
Display all 173 possibilities? (y or n)
... codedPath" : "kjfghl2h34h2l4h",
... "approxTime" : "00:00:30",
... "info" : "direct "
... }]
... }
... }
... }
... }
为什么没有分配到变量以及行
的位置Display all 173 possibilities? (y or n)
来自。有人能搞清楚吗?
修改
我实际上是将文件从mongoVUE粘贴到mongo shell中。
答案 0 :(得分:3)
来自MongoVue的粘贴导致隐藏的字符导致mongo shell在粘贴期间退出到Linux shell。
最好的选择是在记事本++或类似的其他程序中形成它,并保留新的行。