我正在将两个 OR 查询与 mongoose 中的 AND 结合起来,但没有得到想要的结果
{
_id :"23432ferf",
"catId" : 21,
"attributes": [
{
"_id": "571237bfc02aad440c216f67",
"attributeValueM": "metal|Frame Material"
},
{
"_id": "571237bfc02aad440c216f66",
"attributeValueM": "green|color"
}
]
},
{
_id :"23432ferh",
"catId" : 21,
"attributes": [
{
"_id": "571237bfc02aad440c216f67",
"attributeValueM": "metal|Frame Material"
},
{
"_id": "571237bfc02aad440c216f66",
"attributeValueM": "blue|color"
}
]
}
Run Code Online (Sandbox Code Playgroud)
现在通过猫鼬查询是
var condition = [
{ $or: [{ 'attributes.attributeValueM' : 'wood|Frame Material' }, { 'attributes.attributeValueM' : 'metal/Frame Material' }] },
{ $or: [{ 'attributes.attributeValueM' : 'blue|color' }, …Run Code Online (Sandbox Code Playgroud)