My MongoDB has a key-value pair structure, inside my document has a data
field which is an array that contains many subdocuments of two fields: name
and value
.
How do I search for a subdocument e.g ( {"name":"position", "value":"manager"}
) and also multiple (e.g. {"name":"age", "value" : {$ge: 30}}
)
EDIT: I am not looking for a specific subdocument as I mentioned in title (not positional reference), rather, I want to retrieve the entire document but I need it to match the two subdocuments exactly.