mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-11 18:32:50 +00:00
fixed sensor page again
This commit is contained in:
@@ -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){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user