mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-01-10 06:32:15 -05:00
25 lines
834 B
JavaScript
25 lines
834 B
JavaScript
|
// Usage: Paste into mongodb client
|
||
|
|
||
|
VERSIONED_COLLECTIONS = {
|
||
|
'article': db.articles,
|
||
|
'level': db.levels,
|
||
|
'level_component': db.level.components,
|
||
|
'level_system': db.level.systems,
|
||
|
'thang_type': db.thang.types
|
||
|
};
|
||
|
|
||
|
db.patches.find({created:{$gt: '2016-09-08'}}).forEach(function(patch) {
|
||
|
if (!VERSIONED_COLLECTIONS[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);
|
||
|
db.patches.update({_id: patch._id}, {$set: {'target.original': target.original}});
|
||
|
}
|
||
|
else {
|
||
|
print('They are different, they are fine');
|
||
|
}
|
||
|
});
|