文档:
{
"_id": ObjectId("5f841061fcde341740d018ff"),
"status": NumberInt("1"),
"type": [
"5",
"1",
"0"
],
"content": "防冻防冻"
}
// 2
{
"_id": ObjectId("5f841288e82ea24d300001e2"),
"status": NumberInt("1"),
"type": [
"5",
"2",
"0"
],
"content": "防冻防冻"
}
查询语句:
db.content.find({type:{$elemMatch:{$eq:"2"}}})
运行结果:
查询语句(多个):
db.content.find({
$or:[
{type:{$elemMatch:{$eq:"1"}}},
{type:{$elemMatch:{$eq:"2"}}}
]
})
运行结果(多个):