2
的MongoDB数据库:地图时间戳减少
{"thread": "abc", "message": "hjhjh", "Date": (2010,4,5,0,0,0)}
{"thread": "abc", "message": "hjhjh", "Date": (2009,3,5,0,0,0)}
{"thread": "efg", "message": "hjhjh", "Date": (2010,3,7,0,0,0)}
{"thread": "efg", "message": "hjhjh", "Date": (2011,4,5,0,0,0)}
我怎么能映射简化或聚合上述数据来生成输出:
{"thread": "abc", "messages_per_month": 5}
{"thread": "efg", "messages_per_month": 4}
我尝试写一些代码,但在未排序的日期很难平均。是否有任何内置的函数可以平均按时完成?
谢谢!最大值,最小值使它变得容易。 – codious 2012-04-11 08:55:59