mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-15 10:17:33 -05:00
First Commit
This commit is contained in:
28
mongo/totals.js
Normal file
28
mongo/totals.js
Normal file
@@ -0,0 +1,28 @@
|
||||
db = db.getMongo().getDB( "scanner" );
|
||||
var results = db.calls.aggregate(
|
||||
[ {
|
||||
$project: {
|
||||
len: true,
|
||||
year: {$year: "$time"},
|
||||
month: {$month: "$time"},
|
||||
dayOfMonth: {$dayOfMonth: "$time"}
|
||||
}
|
||||
},
|
||||
{
|
||||
$group:
|
||||
{
|
||||
_id: {
|
||||
year: '$year',
|
||||
month: '$month',
|
||||
dayOfMonth: '$dayOfMonth'
|
||||
},
|
||||
totalAudio: { $sum: "$len" },
|
||||
count: { $sum: 1 }
|
||||
}
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
results.forEach(function(document) {
|
||||
printjson(document);
|
||||
});
|
||||
Reference in New Issue
Block a user