Commit 3161c460 by Brian Beggs

Adding the indexs to the migration scripts

parent 702dd93f
print ("Add the new indexes for the context field");
db.contents.ensureIndex({ _type: 1, course_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( db.contents.update(
{_type: "CommentThread", context: {$exists: false}}, {_type: "CommentThread", context: {$exists: false}},
......
print ("remove the indexes for the context field");
db.contents.dropIndex({ _type: 1, course_id: 1, context: 1, pinned: -1, created_at: -1 })
db.contents.dropIndex({ _type: 1, commentable_id: 1, context: 1, pinned: -1, created_at: -1 })
print ("Removing context from all comment threads\n"); print ("Removing context from all comment threads\n");
db.contents.update( db.contents.update(
{_type: "CommentThread"}, {_type: "CommentThread"},
......
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