使用robomongo在json文档中搜索

时间:2015-04-20 19:09:35

标签: mongodb robo3t

我有一个json文档如下:

{
"_id" : ObjectId("553547d3864c23ae8837f8f2"),
"labels" : {
    "id" : "1",
    "name" : "Planet E",
    "sublabels" : "Antidote (4)Community ProjectsGuilty PleasuresI Ner Zon SoundsPlanet E Communications, Inc.TWPENTY",
    "contactinfo" : "Planet E Communications\nP.O. Box 27218\nDetroit, 48227, USA\n\np: 313.874.8729 \nf: 313.874.8732\n\nemail: info AT Planet-e DOT net\n",
    "profile" : "Classic Techno label from Detroit, USA.\n[b]Label owner:[/b] [a=Carl Craig].\n",
    "dataquality" : "Needs Vote",
    "urls" : "http://planet-e.nethttp://planetecommunications.bandcamp.comhttp://www.discogs.com/user/planetedetroithttp://www.facebook.com/planetedetroithttp://www.flickr.com/photos/planetedetroithttp://plus.google.com/100841702106447505236http://myspace.com/planetecomhttp://myspace.com/planetedetroithttp://soundcloud.com/planetedetroithttp://twitter.com/planetedetroithttp://vimeo.com/user1265384http://www.youtube.com/user/planetedetroithttp://en.wikipedia.org/wiki/Planet_E_Communications"
}
}

当我使用以下命令时

db.labels.find({name: "Planet E"})

我得到以下结果

enter image description here

我做错了什么?

1 个答案:

答案 0 :(得分:5)

您需要搜索db.labels.find({ "labels.name": "Planet E" })name属性位于labels密钥下。