mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 08:50:58 -05:00
Tweak fix-patch-originals script
This commit is contained in:
parent
4c277a1b1a
commit
7efccfeac4
1 changed files with 6 additions and 3 deletions
|
@ -10,15 +10,18 @@ VERSIONED_COLLECTIONS = {
|
|||
|
||||
db.patches.find({created:{$gt: '2016-09-08'}}).forEach(function(patch) {
|
||||
if (!VERSIONED_COLLECTIONS[patch.target.collection]) {
|
||||
print('skip', patch.target.collection);
|
||||
//print('skip', patch.target.collection);
|
||||
return;
|
||||
}
|
||||
if (patch.target.original && patch.target.id && patch.target.original.equals(patch.target.id)) {
|
||||
target = VERSIONED_COLLECTIONS[patch.target.collection].findOne({_id: patch.target.original});
|
||||
print('found original', target, target._id, target.original);
|
||||
print('Update patch:',
|
||||
JSON.stringify({_id: patch._id}),
|
||||
JSON.stringify({$set: {'target.original': target.original}})
|
||||
);
|
||||
db.patches.update({_id: patch._id}, {$set: {'target.original': target.original}});
|
||||
}
|
||||
else {
|
||||
print('They are different, they are fine');
|
||||
//print('They are different, they are fine');
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue