init day collections

This commit is contained in:
Michele 2018-06-05 12:22:00 +02:00
parent 1e55b6e6f0
commit 806d5f0a6a

7
day_init.js Normal file
View file

@ -0,0 +1,7 @@
var db = connect("192.168.0.1:27017/lastlogin");
//var conn = new Mongo("192.168.0.1");
//var db = conn.getDB("lastlogin");
var dd = function(x) { if(x==0){x++}; var s = x.toString(); if(s.length > 1){return s;} else { return "0"+s;}}
var now = new Date();
var col = now.getFullYear() + dd(now.getMonth()) + dd(now.getDate())
db.getCollection("ll_"+col.slice(2)).createIndexes([{"date": 1},{"country": 1},{"user": 1,"date": -1}])