From ed7b30f512567ec8f585c03a42ce674e43ee3dae Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Sun, 30 Nov 2014 14:29:50 +0100 Subject: [PATCH] also update anon configs --- bin/mongodb/config-timemode.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/bin/mongodb/config-timemode.js b/bin/mongodb/config-timemode.js index 05e3e0382f..f7a310a116 100644 --- a/bin/mongodb/config-timemode.js +++ b/bin/mongodb/config-timemode.js @@ -1,16 +1,18 @@ -db.config.find().forEach(function(o) { - var sets = {}; - var unsets = {}; - ['friend', 'hook', 'ai'].forEach(function(type) { - if (!o[type]) return; - sets[type + '.tm'] = o[type].k ? NumberInt(1) : NumberInt(0); - sets[type + '.d'] = NumberInt(2); - unsets[type + '.k'] = true; - }); - db.config.update({ - _id: o._id - }, { - $set: sets, - $unset: unsets +[db.config, db.config_anon].forEach(function(coll) { + coll.find().forEach(function(o) { + var sets = {}; + var unsets = {}; + ['friend', 'hook', 'ai'].forEach(function(type) { + if (!o[type]) return; + sets[type + '.tm'] = o[type].k ? NumberInt(1) : NumberInt(0); + sets[type + '.d'] = NumberInt(2); + unsets[type + '.k'] = true; + }); + coll.update({ + _id: o._id + }, { + $set: sets, + $unset: unsets + }); }); });