我想找到一个并通过 moduleId
和 name
过滤配置文件
{
"moduleId": 1,
"access": {
"del": ..,
"editWrite": ...,
"read": ....
}
}
文档看起来像这样:
"profileAccess": [
{
"moduleId": 1,
"access": {
"del": true,
"editWrite": true,
"read": true
}
},
{
"moduleId": 2,
"access": {
"del": true,
"editWrite": true,
"read": true
}
}
],
"name": "admin"
},
答案 0 :(得分:0)
找到答案了,我好像忘记回复了
Profile.findOne({name:"admin"},{profileAccess: { $elemMatch: { moduleId: 1} }});