mongoose - how to get the matching document inside a array in mongodb? -
my collection this
{ _id :"", name:[ { firstname:"", lastname:"", } ] } i need find matching firstname in documents. how achieve in query ? new mongodb.
db.collection.find({name: {$elemmatch: {firstname: "raj"}}}); for further details check out documentation $elemmatch
Comments
Post a Comment