mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Tweak course population script
This commit is contained in:
parent
72e4e6c6c8
commit
7479357869
1 changed files with 11 additions and 6 deletions
|
@ -26,9 +26,14 @@ for (var courseIndex in courses) {
|
|||
|
||||
print('constructed', JSON.stringify(coursesData, null, '\t'));
|
||||
|
||||
db.classrooms.update(
|
||||
{}, // Set all
|
||||
//{courses: {$exists: false}}, // Set all w/out values
|
||||
{$set: {courses: coursesData}},
|
||||
{multi: true}
|
||||
);
|
||||
db.classrooms.find({}, {courses:1}).forEach(function(classroom) {
|
||||
print('classroom', classroom._id);
|
||||
if(classroom.courses) {
|
||||
print('\tskipping');
|
||||
return;
|
||||
}
|
||||
db.classrooms.update(
|
||||
{_id: classroom._id},
|
||||
{$set: {courses: coursesData}}
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue