【发布时间】:2018-12-24 04:43:37
【问题描述】:
我想获得没有“SENT”状态的姓名总数,我还想根据开始和结束日期过滤这个数字,目前只有第一部分走过它标志着按日期过滤。我的领域被称为“日期”。 抱歉我的代码没有缩进):
db.name.aggregate([{ $group: {_id:"$id", sent:
{$max: {$cond: {if: {
$eq: [ "$status", "SENT" ] }, then: 1, else: 0}}} } },
{ $match: { sent:
0 } }, {$count: "total"}])
【问题讨论】: