I need the seen_on array to become [20160313, 20160324]
Hi Dmitry,
Given your document example, you could filter the value of seen_on
field with first_seen_on
field like below:
db.collection.aggregate([
{ $project:
{ filtered :
{ $filter:
{ input: "$seen_on",
as: "date",
cond: {$ne:["$$date", "$first_seen_on"]}
}
}
}
}
]);
Note that you need to refer to date
using double dollar $$
sign. See $filter for more info.
Regards,
Wan.