我在mongodb中有以下数据
{
"_id" : ObjectId("5641f77344aef29028a86d9b"),
"timestamp" : "2015-09-21 00:01:34",
"day_chan1" : NumberInt(0),
"day_chan2" : NumberInt(0),
"day_chan3" : NumberInt(65),
"gatwayId" : "4437191001a3"
}
{
"_id" : ObjectId("5641f77344aef29028a86d9c"),
"timestamp" : "2015-09-21 00:02:34",
"day_chan1" : NumberInt(0),
"day_chan2" : NumberInt(0),
"day_chan3" : NumberInt(97),
"gatwayId" : "4437191001a3"
}
{
"_id" : ObjectId("5641f77344aef29028a86d9d"),
"timestamp" : "2015-09-21 00:03:34",
"day_chan1" : NumberInt(0),
"day_chan2" : NumberInt(0),
"day_chan3" : NumberInt(130),
"gatwayId" : "4437191001a3"
}
我想从给定数据ph1 = day_chan1 of current - day_chan2 of previous object
计算三个额外的字段ph1,ph2,ph3。这可以使用mongoose或纯mongodb中的聚合物来完成吗?