A question about MongoDB/mongoose queries using $in http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24in
If I do a query where both the target field AND the $in field have multiple values, is there a way to know which target/$in field elements were matched in a returned argument?
Eg if I have a bunch of documents like this
doc1 = { name : Abe, children : [Betty, Claire, Donald, Eamon] }
and i set up a query
Model.find( { children : { $in : [Ann, Betty, Clive] } })
if i get the result doc1 above, is there any way i can know (without iterating through the arrays manually) which target element and which $in element were matched? so in the case above, how could I access the fact that doc1 was chosen because it matched 'Betty'? Thanks in advance!
You must manually check the mongoose doc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With