Record I have:
[ {
"url": "a",
"nested_object_keys": [
{
"vendor": "terraform",
"tag": "some_tag_1"
},
{
"vendor": "terraform",
"tag": "some_tag_2"
},
{
"vendor": "terraform",
"tag": "some_tag_3"
},
{
"vendor": "terraform",
"tag": "some_tag_4"
}
] }
Expected Output: I should only get the array objects that matches with the value of key : some_tag_1 (if only key with this value present) or some_tag_2 ((if only key with this value present)or both if both values present.
[ {
"url": "a",
"nested_object_keys": [
{
"vendor": "terraform",
"tag": "some_tag_1"
},
{
"vendor": "terraform",
"tag": "some_tag_2"
}
] }
I have tried elemMatch with so many operators in, and, or , all. But I got result like all the available objects in array or only single document that matched first but not the both. Limitation: Aggregation should not be used.