我的需求:我想查找_id 为 5b35fdfeea0b0221640b2039 并且数组 starPropertys 里包含了 5b35fdffea0b0221640b203b 的数据
我有一个集合符合条件,它这样的:
{
"_id": "5b35fdfeea0b0221640b2039",
"power": [],
"score": 0,
"starPropertys": [
"5b35fdffea0b0221640b203b",
"5b35fe07ea0b0221640b203d"
],
"active": true,
"email": "[email protected]",
"password": "$2a$10$PoTkIE0WyVHvSnUGH60hNeHQIw1UWUvvpaN3ra4/v49tw87e1GJ1m",
"createTime": 1530265086887,
"updateTime": 1530265086887,
"__v": 0,
"nickname": "jack ma"
}
我的查询语句如下:
this.ctx.model.Col.findOne({
$and: [
{
_id: userId,
},
{
"starPropertys": propertyId
}
]
}).exec();
然而并没有查到任何数据,我想请问如何实现我这样的需求?