是否可以在嵌套文档中查询特定对象?这是一个例子,
Collection : Threads
{
Documents : Messages
{
threadId = 1
messages = [
{
user = amy
date = 01/01/2012
content = hey
},
{
user = bell
date = 01/01/2012
content = hey
},
{
user = bell
date = 01/02/2012
content = whats up
}
]
},
{
threadId = 2
messages = [
{
user = courtney
date = 01/03/2012
content = first!
}
]
}
}
我想我的查询说{ threadId : 1, 'messages.date' : { $gt : 01/01/2012 } }, { fields : { messages : 1 } }
。但是当我真正想要的结果是这样时,它会返回所有这些文档消息,
messages = [
{
user = bell
date = 01/02/2012
content = whats up
}
]