β

Answer by zangw for Query to return single child d

User zangw - Stack Overflow 44 阅读

To get todo with the id of 2 for the employee with the id of 1, you could do it through aggregation

Employee.aggregate([
                   {$unwind: '$todo'},
                   {$match: {id: 1, `todo.id`: 2}}
   ]);
作者:User zangw - Stack Overflow
most recent 30 from stackoverflow.com
原文地址:Answer by zangw for Query to return single child d, 感谢原作者分享。

发表评论