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

25
mongo/trim.js Normal file
View File

@@ -0,0 +1,25 @@
db = db.getMongo().getDB( "scanner" );
var bulkRemove = db.calls.initializeUnorderedBulkOp()
var short_date = new Date();
db.systems.find().forEach(
function(system){
var date = new Date();
var total =0;
if (system.planType == 10){
date.setMonth(date.getDate() - 30);
} else {
date.setDate(date.getDate() - 7);
}
print(system.shortName);
bulkRemove.find({"time":{$lt: date}, "shortName": system.shortName}).remove();
});
//bulkInsert.execute()
var results = bulkRemove.execute();
print("Removed: " + results.nRemoved);