【发布时间】:2017-03-09 21:20:12
【问题描述】:
我有一个集合,里面的文档是这样的:
{
"person-name" : "Hughart, Ron",
"info" : {
"birthnotes" : [ "Los Angeles, California, USA" ],
"birthdate" : [ "18 June 1961" ],
"birthname" : [ "Hughart, Ronald P" ]
}
}
我想找到在里斯本出生的人。问题是我如何知道记录的字段"info.birthnotes" 是否包含"Lisbon"?
我试过这个命令:
db.collection.find({"info.birthnotes": {"$in": ["Lisbon"]}})
但它什么也不返回。
【问题讨论】:
-
在您的示例中 info.birthnotes 不包含“里斯本”
标签: arrays mongodb find mongodb-query