Commit 634612a5 by Feanil Patel

Merge pull request #136 from edx/feanil/update_context_migration

Use bulk operation instead.
parents 1dff2db4 05758888
...@@ -3,9 +3,7 @@ db.contents.ensureIndex({ _type: 1, course_id: 1, context: 1, pinned: -1, create ...@@ -3,9 +3,7 @@ db.contents.ensureIndex({ _type: 1, course_id: 1, context: 1, pinned: -1, create
db.contents.ensureIndex({ _type: 1, commentable_id: 1, context: 1, pinned: -1, created_at: -1 }, {background: true}) db.contents.ensureIndex({ _type: 1, commentable_id: 1, context: 1, pinned: -1, created_at: -1 }, {background: true})
print ("Adding context to all comment threads where it does not yet exist\n"); print ("Adding context to all comment threads where it does not yet exist\n");
db.contents.update( var bulk = db.contents.initializeUnorderedBulkOp();
{_type: "CommentThread", context: {$exists: false}}, bulk.find( {_type: "CommentThread", context: {$exists: false}} ).update( {$set: {context: "course"}} );
{$set: {context: "course"}}, bulk.execute();
{multi: true}
);
printjson (db.runCommand({ getLastError: 1, w: "majority", wtimeout: 5000 } )); printjson (db.runCommand({ getLastError: 1, w: "majority", wtimeout: 5000 } ));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment