Is it possible to return multiple subdocuments with mongoDB and Node.js? Is it possible to return multiple subdocuments with mongoDB and Node.js? mongoose mongoose

Is it possible to return multiple subdocuments with mongoDB and Node.js?


You can use $unwind for this it will fetch you multiple entries from collection unlike element match or '.' operator which return only first match data

User.aggregate(        {$unwind : "$position"},        {$match:{'position.title': position}}).exec(function (err, result) {      console.log(result);      res.send({ results: result });  });