// v1.1 var db = connect("192.168.0.1:27017/lastlogin"); var dd = function(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()+1) + dd(now.getDate()) print("creating index: ll_",col.slice(2)); db.getCollection("ll_"+col.slice(2)).createIndexes([{"date": 1},{"country": 1},{"user": 1,"date": -1}]) var db = connect("192.168.0.1:27017/katamail"); var dd = function(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()+1) + dd(now.getDate()) print("creating index: ll_",col.slice(2)); db.getCollection("ll_"+col.slice(2)).createIndexes([{"date": 1},{"country": 1},{"user": 1,"date": -1}])