标签: mongodb date aggregates
我需要过滤日期文档,但我只需要最近6个月的文档即可。
mi collection类似于
{_id: id, desc:desc, createdAt: ISODate(//date in past) }
我需要
Collection.aggregate([ { "$match": { "createdAt": { "$gt": pastDate } } } ]);
我需要计算“ pastDate”,例如 新的Date()-6(月)