i want to calculate my electricity usage. we are using 3 period for each day
22:00 - 06:00 is T1
06:00 - 17:00 is T2
17:00 - 22:00 is T3
i can calculate from php but i am switched my database couchdb to mongodb.
i'm receiving data every minute and i need to make group usages example like this.
T1 = 06:00 max(s) value - prevday 22:00 max(s) value
.... i understand how $project using but i cant make it.
My example data is this and for calculation i use S value from the data.(raw watt)
/* 1 */
{
"_id" : ObjectId("586e77658ce7580929392122"),
"act" : 7613313,
"rct" : 0.0,
"cos" : 1.0,
"hz" : 50.01,
"s" : 988940600.0,
"type" : "electric",
"t" : 1483645333,
"utc_date" : ISODate("2017-01-05T16:42:13.000Z")
}
/* 2 */
{
"_id" : ObjectId("586e779f0ce3797b684845f6"),
"act" : 7613652,
"rct" : 0.0,
"cos" : 1.0,
"hz" : 50.01,
"s" : 988984700.0,
"type" : "electric",
"t" : 1483645391,
"utc_date" : ISODate("2017-01-05T16:43:11.000Z")
}