From 5c306cac56bdf68fdb07618efe81e8c4dbac647f Mon Sep 17 00:00:00 2001 From: mgerb42 Date: Thu, 21 Jan 2016 19:38:12 -0600 Subject: [PATCH] reverted changes - will work on another time --- routes/sensors.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/routes/sensors.js b/routes/sensors.js index 9f437dd..be664c8 100644 --- a/routes/sensors.js +++ b/routes/sensors.js @@ -9,8 +9,7 @@ var temperature = mongoose.model('temperature'); /* GET sensors page. */ router.get('/', function(req, res, next) { - temperature.aggregate( [{$project : {location : 1, temperature : 1, humidity : 1, sDate : {$subtract : ["$updated", 21600000]}}}, - { $group : { _id : "$location", temperature : {$last : "$temperature"}, humidity : {$last : "$humidity"}, updated : {$last : "$sDate"}}}, + temperature.aggregate( [{ $group : { _id : "$location", temperature : {$last : "$temperature"}, humidity : {$last : "$humidity"}, updated : {$last : "$updated"}}}, {$sort : {location : -1, updated : -1}} ] ).exec(function(err, info){ //get month for each entry and convert 24 hour time to US time