为什么我不能在mongovue上插入这个json

时间:2012-12-20 03:33:42

标签: json mongodb mongovue

{
  "_id" : "648290899",
  "First_Name" : "Daniel",
  "Last_Name" : "Wu",
  "Gender" : "male",
  "Birthday" : "13/10/1978",
  "Email" : "dgozali@binacitra.com",
  "Bookmark" : ["mal-taman-anggrek__-6.18_106.79"],
  "Token" : "",
  "LikeOrDislike" : {
    "mal-taman-anggrek__-6.18_106.79" : 1,
    "bebek-goreng-h.-slamet__-6.20_106.77" : 1,
    "mcdonald's__-6.31_106.86" : 1,
    "pasar-rebo__-6.31_106.87" : 0
  },
  "Nearby" : [],
  "History" : [{
      "1355915008" : {
        "day" : "December 19, 2012, 6:03 pm",
        "LikeOrDislike" : {
          "mal-taman-anggrek__-6.18_106.79" : 1
        }
      }
    }, {
      "1355915015" : {
        "day" : "December 19, 2012, 6:03 pm",
        "Bookmark" : {
          "add" : ["mal-taman-anggrek__-6.18_106.79"]
        }
      }
    }, {
      "1355920137" : {
        "day" : "December 19, 2012, 7:28 pm",
        "LikeOrDislike" : {
          "bebek-goreng-h.-slamet__-6.20_106.77" : 1
        }
      }
    }, {
      "1355920233" : {
        "day" : "December 19, 2012, 7:30 pm",
        "LikeOrDislike" : {
          "mcdonald's__-6.31_106.86" : 1
        }
      }
    }, {
      "1355920441" : {
        "day" : "December 19, 2012, 7:34 pm",
        "LikeOrDislike" : {
          "pasar-rebo__-6.31_106.87" : 0
        }
      }
    }],
  "ImageProfile" : "http://graph.facebook.com/648290899/picture/?type=large"
}

我得到了一个抱怨,即pasar-rebo __- 6.31_106.87包含一个点。好吧它包含一个点。所以?

1 个答案:

答案 0 :(得分:4)

  

字段名称不能包含点(即。),美元符号(即$)或空字符。

来源:the MongoDB official doc

原因是Mongo允许使用javascript样式的点表示法来访问子集合。 此外,如here

所述,点用作嵌入文档的分隔符