1 point

How do I query referenced objects in MongoDB? - Stack Overflow


dashboard

Thu May 21 2020 18:26:52 GMT+0000 (UTC)

Posted by @salitha.pathi #javascript

db.Foo.aggregate(
  {$unwind: "$bars"},
  {$lookup: {
    from:"bar",
    localField: "bars",
    foreignField: "_id",
    as: "bar"

   }},
   {$match: {
    "bar.testprop": true
   }}
)
content_copy
https://stackoverflow.com/questions/9621928/how-do-i-query-referenced-objects-in-mongodb

>> Browse more code snippets

more_vert