I have a collection that looks something like:
[
{
"_id": 1,
"title": "dummy title",
"settings": [
{
"type": "light",
"status": "enabled"
},
{
"type": "flare",
"status": "disabled"
},
{
"type": "toolbar",
"status": "enabled"
}
]
}
]
I wanna fetch it by Id but only with the "enabled" settings and not sure how the aggregation pipeline should look like.
I supposed to create the query using mongoTemplate in Java / Kotlin but even just the mongo query would be enough.
You can do it with a
$filter
try it here