At a certain point of my pipeline, I have a structure like this :
[
{
_id: 1,
elems1: [{sub : {date: xxx}}, {sub: {date: yyy}}],
elems2: [{sub: {date: zzz}}, {sub: {date: qqq}}]
},
...
]
Which comes from a grouping :
{$group: {
_id: '$user.id',
elems1: {
$push: {sub: '$other'}
},
elems2: {
$push: {sub: '$other'}
}
}
}}
Now I want to delete the groups that have an element in elems1 OR elems2 with sub.date less than a certain date, how could I do this ?