根据多个条件排除文件

时间:2018-08-04 11:18:29

标签: mongodb aggregation-framework

我的收藏集具有以下架构:

{
_id:1,
eventname:"Add to Cart",
userId:1,
attributes:{amount:1000,item:"shirt"}
},
{
_id:2,
 eventname:"Add to Cart",
userId:1,
attributes:{amount:1000,item:"shoes"}
},
{
_id:3,
eventname:"Item Viewed",
userId:2,
attribtes:{product:"laptop",size:"14-in"}
},
{
_id:4,
 eventname:"Item Viewed",
 userId:2,
     attribtes:{product:"laptop",size:"15-in"}
 },
 {
 _id:5,
  eventname:"Add to Cart",
  userId:2,
  attribtes:{amount:"1500",item:"trouser"}
  }

返回未执行的userId列表

事件名称已查看的项目,产品是15英寸大小的笔记本电脑。

预期输出:除_id = 4以外的所有文档

0 个答案:

没有答案