In the following collection, how would I return all documents, but remove objects from the foos
array where bar != 'en'
{
"name": "Item 1"
"f开发者_StackOverflow中文版oos": [
{
"foo": "bar",
"bar": "en"
}
{
"foo": "bar",
"bar": "fr"
}
{
"foo": "bar",
"bar": "en"
}
]
}
Thanks
You cannot easily. You need this feature: http://jira.mongodb.org/browse/SERVER-1831
MongoDB hasn't support virtual collections。So you can not get the part of sub-documents.Now you can create new document which you want to get the part of sub-documents。See http://jira.mongodb.org/browse/SERVER-142
精彩评论