Sederhana, cukup ubah skema Anda.
https://mongoplayground.net/p/npSvVzbnsyk
{
"name": "device1",
"modules": [
{
"k": "camera",
"v": 3
}
]
},
{
"name": "device2",
"modules": [
{
"k": "wifi",
"v": 3
},
{
"k": "camera",
"v": 2
}
]
},
{
"name": "device3",
"modules": [
{
"k": "wifi",
"v": 2
}
]
}
db.collection.find({"modules.v": 3})