1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-11 10:22:53 +00:00

fixed sensor page again

This commit is contained in:
2016-01-21 19:36:28 -06:00
parent d35c79920b
commit 4b7dfad2f8

View File

@@ -9,7 +9,7 @@ var temperature = mongoose.model('temperature');
/* GET sensors page. */
router.get('/', function(req, res, next) {
temperature.aggregate( [{$project : {sDate : {$subtract : ["$updated", 21600000]}}},
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"}}},
{$sort : {location : -1, updated : -1}} ] ).exec(function(err, info){