β

Answer by zangw for How to extract unique data on

User zangw - Stack Overflow 46 阅读

One way to get the unique on basic of carpetArea and type is through aggregation , sample codes are

Flat.aggregate([
      {$match: { project: req.params.project, isDeleted: false}},
      {$group: {_id: {carpetArea: '$carpetArea', type: '$type'},
                status: {$first: '$status'},
                // other field are here same type above
               }}
      ]);
作者:User zangw - Stack Overflow
most recent 30 from stackoverflow.com
原文地址:Answer by zangw for How to extract unique data on , 感谢原作者分享。

发表评论