如题,比如我要查询文档列表
List = [ { _id:xxxxxx, source:{ title:"hello1", ..... } }, { _id:xxxxx, source:{ title:"hello2" } } ]
我希望查询出title为hello1的文档集合出来,这个咋搞,更高维度的查询则以此类推 什么情况,为啥一直搜索不到我的问题
貌似:
find({'source.title': 'hello1'})
官方文档 (看来你搜得不仔细呀) http://docs.mongodb.org/manual/core/document/#dot-notation
请叫我雷锋 : $elemMatch
http://docs.mongodb.org/manual/reference/operator/query/elemMatch/
seminarModel.find({ companyAssignment : {$elemMatch : {studentList: { $in: [email] }} }, isInitialized :true }).sort('seminarId').execQ().then(function(allSeminars){})