add mongo script
This commit is contained in:
parent
62f483a136
commit
01d9f9cc34
21
bin/mongodb/gm-bootstrap.js
Normal file
21
bin/mongodb/gm-bootstrap.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
var userIds = ['GeorgMeier'].map(u => u.toLowerCase());
|
||||
var perfType = 'bullet';
|
||||
var perf = {
|
||||
"gl": {
|
||||
"r": 2500,
|
||||
"d": 150,
|
||||
"v": 0.06
|
||||
},
|
||||
"nb": NumberInt(0),
|
||||
"re": [ ]
|
||||
};
|
||||
|
||||
userIds.forEach(id => {
|
||||
var user = db.user4.findOne({_id:id});
|
||||
if (user && (!user.perfs[perfType] || !user.perfs[perfType].nb))
|
||||
db.user4.update({_id:id},{$set:{['perfs.' + perfType]: perf}});
|
||||
db.tournament_player.update(
|
||||
{uid:id,r:1500,m:150},
|
||||
{$set:{r:NumberInt(perf.gl.r),m:NumberInt(perf.gl.r/10)}},
|
||||
{multi:1});
|
||||
});
|
Loading…
Reference in a new issue