mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-31 07:12:49 -04:00
Added a folder for putting utility mongodb scripts.
This commit is contained in:
parent
9ae8847be0
commit
bb7a28e3ad
1 changed files with 13 additions and 0 deletions
13
scripts/mongodb/queries/patches.js
Normal file
13
scripts/mongodb/queries/patches.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
// Finds all patches and denorms their target names and creators.
|
||||
|
||||
var patches = db.patches.find({status:'pending'}).toArray();
|
||||
for(var i in patches) {
|
||||
var patch = patches[i];
|
||||
var collection = null;
|
||||
if(patch.target.collection === 'level') collection = db.levels;
|
||||
if(patch.target.collection === 'level_component') collection = db.level.components;
|
||||
if(patch.target.collection === 'level_system') collection = db.level.systems;
|
||||
var target = collection.findOne({original:patch.target.original, name:{$exists:true}});
|
||||
var creator = db.users.findOne({_id:patch.creator});
|
||||
print(target.name, 'made by', creator.name);
|
||||
}
|
Loading…
Add table
Reference in a new issue