First Commit

This commit is contained in:
Luke Berndt
2020-06-09 22:11:11 -04:00
parent 8f49aa463c
commit 3b0d3f290f
551 changed files with 193130 additions and 2 deletions

51
mongo/errors.js Normal file
View File

@@ -0,0 +1,51 @@
db = db.getMongo().getDB( "scanner" );
var start = new Date();
start.setHours(start.getHours() - 1);
var results = db.calls.aggregate([{
$match: {
time: {
$gte: start
},
shortName: 'dcfd'
}
},
{
"$unwind": "$freqList"
},
{
"$project": {
"freqList": 1,
"errorRatio": {
$cond: [{
$eq: ["$freqList.len", 0]
}, 0, {
"$multiply": [{
"$divide": ["$freqList.errors", "$freqList.len"]
}, 100]
}]
},
"time": "$time"
}
},
{
"$group": {
"_id": "$freqList.freq",
"values": {
"$push": {
"time": "$time",
"errors": "$errorRatio",
"spikes": "$freqList.spikes"
}
}
}
},
{
$sort: {
_id: -1
}
}]);
results.forEach(function(document) {
printjson(document);
});