考虑下面的文档:
有没有方法可以返回文档,除了
以下是一个示例文件:
{
"_id": 1,
"name" : "bob",
"alotofstuff": [],
"morestuff",
"item": {
"name": "baumeister",
"manyfieldshere": 1,
"evenmore": 2
}
}
有没有方法可以返回文档,除了
name
字段以外,不带有item
的所有属性,就像这样:{
"_id": 1,
"name" : "bob",
"alotofstuff": [],
"morestuff",
"item": {
"name": "baumeister",
}
}
我希望避免编写需要包含所有其他字段的投影{ name: 1, alotofstuff: 1, morestuff: 1, item.name: 1 }
(实际文档要复杂得多)。