init day collections
This commit is contained in:
parent
1e55b6e6f0
commit
806d5f0a6a
1 changed files with 7 additions and 0 deletions
7
day_init.js
Normal file
7
day_init.js
Normal 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}])
|
Loading…
Add table
Reference in a new issue