{"action":"created","comment":{"url":"https://api.github.com/repos/edx/cs_comments_service/pulls/comments/49477359","id":49477359,"diff_hunk":"@@ -0,0 +1,76 @@\n+var list_of_final_index_names = [\n+    \"parent_id_1\",\n+    \"parent_ids_1\",\n+    \"tags_array_1\",\n+    \"votes.up_1__type_1\",\n+    \"votes.down_1__type_1\",\n+    \"commentable_id_1_created_at_-1\",\n+    \"course_id_1__type_1_created_at_-1\",\n+    \"_type_1_comment_thread_id_1_author_id_1_updated_at_1\",\n+    \"comment_thread_id_1_sk_1\",\n+    \"comment_thread_id_1_endorsed_1\",\n+    \"_type_1_course_id_1_pinned_-1_created_at_-1\",\n+    \"_type_1_course_id_1_pinned_-1_comment_count_-1_created_at_-1\",\n+    \"_type_1_course_id_1_pinned_-1_votes.point_-1_created_at_-1\",\n+    \"commentable_id_1\",\n+    \"_type_1_course_id_1_context_1_pinned_-1_created_at_-1\",\n+    \"_type_1_context_1\",\n+    \"_type_-1_course_id_1_context_1_pinned_-1_last_activity_at_-1_created_at_-1\",\n+    \"_type_-1_course_id_1_commentable_id_1_context_1_pinned_-1_created_at_-1\",\n+    \"_type_-1_course_id_1_endorsed_-1_pinned_-1_last_activity_at_-1_created_at_-1\",\n+    \"_type_-1_course_id_1_endorsed_-1_pinned_-1_votes.point_-1_created_at_-1\",\n+    \"_type_-1_course_id_1_endorsed_-1_pinned_-1_comment_count_-1_created_at_-1\",\n+    \"author_id_1_course_id_1\"\n+];\n+\n+var list_of_final_index_commands = [\n+    '{parent_id: 1}, { background: true }',\n+    '{parent_ids: 1}, { background: true }',\n+    '{tags_array: 1}, { background: true }',\n+    '{votes.up: 1, _type: 1}, { background: true }',\n+    '{votes.down: 1, _type: 1}, { background: true }',\n+    '{commentable_id: 1, created_at: -1}, { background: true }',\n+    '{course_id: 1, _type: 1, created_at: -1}, { background: true }',\n+    '{_type: 1, comment_thread_id: 1, author_id: 1, updated_at: 1}, { background: true }',\n+    '{comment_thread_id: 1, sk: 1}, { background: true , sparse: true}',\n+    '{comment_thread_id: 1, endorsed: 1}, { background: true , sparse: true}',\n+    '{_type: 1, course_id: 1, pinned: -1, created_at: -1}, { background: true }',\n+    '{_type: 1, course_id: 1, pinned: -1, comment_count: -1, created_at: -1}, { background: true }',\n+    '{_type: 1, course_id: 1, pinned: -1, votes.point: -1, created_at: -1}, { background: true }',\n+    '{commentable_id: 1}, { background: true , sparse: true}',\n+    '{_type: 1, course_id: 1, context: 1, pinned: -1, created_at: -1}, { background: true }',\n+    '{_type: 1, context: 1}, { background: true }',\n+    '{_type: -1, course_id: 1, context: 1, pinned: -1, last_activity_at: -1, created_at: -1}, { background: true }',\n+    '{_type: -1, course_id: 1, commentable_id: 1, context: 1, pinned: -1, created_at: -1}, { background: true }',\n+    '{_type: -1, course_id: 1, endorsed: -1, pinned: -1, last_activity_at: -1, created_at: -1}, { background: true }',\n+    '{_type: -1, course_id: 1, endorsed: -1, pinned: -1, votes.point: -1, created_at: -1}, { background: true }',\n+    '{_type: -1, course_id: 1, endorsed: -1, pinned: -1, comment_count: -1, created_at: -1}, { background: true }',\n+    '{author_id: 1, course_id: 1}, { background: true }'\n+];\n+\n+print(\"Getting list of indexes...\");\n+var json_of_indexes = db.collection.getIndexes();\n+    json_of_indexes = JSON.parse(json);\n+\n+var list_of_current_index_names = [];\n+\n+for (index = 0; index < json_of_indexes.length; index++) { \n+    list_of_current_index_names.push(index.name);\n+}\n+\n+print(\"Current list of indexes:\");\n+print(list_of_current_index_names);\n+\n+print(\"Ensuring indexes...\");\n+for (index = 0; index < list_of_final_index_commands.length; index++) { \n+    print(\"Ensuring\".concat(index));\n+    db.collection.ensureIndex(index);\n+\n+print(\"Dropping extra indexes\");\n+\n+for (index = 0; index < list_of_final_index_names.length; index++) { \n+    if (list_of_current_index_names.indexOf(index > -1);\n+    print(\"Dropping\".concat(index));\n+    db.collection.dropIndex(index);","path":"scripts/db/reset_indexes.js","position":74,"original_position":74,"commit_id":"78413a59654b83a190be6b2127fc7293b2c3239c","original_commit_id":"78413a59654b83a190be6b2127fc7293b2c3239c","user":{"login":"BenjiLee","id":7101723,"avatar_url":"https://avatars.githubusercontent.com/u/7101723?v=3","gravatar_id":"","url":"https://api.github.com/users/BenjiLee","html_url":"https://github.com/BenjiLee","followers_url":"https://api.github.com/users/BenjiLee/followers","following_url":"https://api.github.com/users/BenjiLee/following{/other_user}","gists_url":"https://api.github.com/users/BenjiLee/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjiLee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjiLee/subscriptions","organizations_url":"https://api.github.com/users/BenjiLee/orgs","repos_url":"https://api.github.com/users/BenjiLee/repos","events_url":"https://api.github.com/users/BenjiLee/events{/privacy}","received_events_url":"https://api.github.com/users/BenjiLee/received_events","type":"User","site_admin":false},"body":"Just realized dropping does not work by index name...","created_at":"2016-01-12T16:33:13Z","updated_at":"2016-01-12T16:33:13Z","html_url":"https://github.com/edx/cs_comments_service/pull/175#discussion_r49477359","pull_request_url":"https://api.github.com/repos/edx/cs_comments_service/pulls/175","_links":{"self":{"href":"https://api.github.com/repos/edx/cs_comments_service/pulls/comments/49477359"},"html":{"href":"https://github.com/edx/cs_comments_service/pull/175#discussion_r49477359"},"pull_request":{"href":"https://api.github.com/repos/edx/cs_comments_service/pulls/175"}}},"pull_request":{"url":"https://api.github.com/repos/edx/cs_comments_service/pulls/175","id":55659127,"html_url":"https://github.com/edx/cs_comments_service/pull/175","diff_url":"https://github.com/edx/cs_comments_service/pull/175.diff","patch_url":"https://github.com/edx/cs_comments_service/pull/175.patch","issue_url":"https://api.github.com/repos/edx/cs_comments_service/issues/175","number":175,"state":"open","locked":false,"title":"WIP: Removed outdate index scripts, and added new scripts","user":{"login":"BenjiLee","id":7101723,"avatar_url":"https://avatars.githubusercontent.com/u/7101723?v=3","gravatar_id":"","url":"https://api.github.com/users/BenjiLee","html_url":"https://github.com/BenjiLee","followers_url":"https://api.github.com/users/BenjiLee/followers","following_url":"https://api.github.com/users/BenjiLee/following{/other_user}","gists_url":"https://api.github.com/users/BenjiLee/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjiLee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjiLee/subscriptions","organizations_url":"https://api.github.com/users/BenjiLee/orgs","repos_url":"https://api.github.com/users/BenjiLee/repos","events_url":"https://api.github.com/users/BenjiLee/events{/privacy}","received_events_url":"https://api.github.com/users/BenjiLee/received_events","type":"User","site_admin":false},"body":"https://openedx.atlassian.net/browse/DEVOPS-3333\r\n\r\n@e0d @edx/devops \r\n\r\nRemoves old scripts and replaces them with a single script that ensures a set list of indexes.\r\n\r\nI'm not strong with js so it would be nice to have a way to test this. ","created_at":"2016-01-11T18:30:18Z","updated_at":"2016-01-12T16:33:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4ce0f1ab359da209347d99cb106bfaca3ee57cb6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/cs_comments_service/pulls/175/commits","review_comments_url":"https://api.github.com/repos/edx/cs_comments_service/pulls/175/comments","review_comment_url":"https://api.github.com/repos/edx/cs_comments_service/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/cs_comments_service/issues/175/comments","statuses_url":"https://api.github.com/repos/edx/cs_comments_service/statuses/78413a59654b83a190be6b2127fc7293b2c3239c","head":{"label":"edx:clee/update_index_scripts","ref":"clee/update_index_scripts","sha":"78413a59654b83a190be6b2127fc7293b2c3239c","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":4732120,"name":"cs_comments_service","full_name":"edx/cs_comments_service","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/cs_comments_service","description":"server side of the comment service","fork":false,"url":"https://api.github.com/repos/edx/cs_comments_service","forks_url":"https://api.github.com/repos/edx/cs_comments_service/forks","keys_url":"https://api.github.com/repos/edx/cs_comments_service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/cs_comments_service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/cs_comments_service/teams","hooks_url":"https://api.github.com/repos/edx/cs_comments_service/hooks","issue_events_url":"https://api.github.com/repos/edx/cs_comments_service/issues/events{/number}","events_url":"https://api.github.com/repos/edx/cs_comments_service/events","assignees_url":"https://api.github.com/repos/edx/cs_comments_service/assignees{/user}","branches_url":"https://api.github.com/repos/edx/cs_comments_service/branches{/branch}","tags_url":"https://api.github.com/repos/edx/cs_comments_service/tags","blobs_url":"https://api.github.com/repos/edx/cs_comments_service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/cs_comments_service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/cs_comments_service/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/cs_comments_service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/cs_comments_service/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/cs_comments_service/languages","stargazers_url":"https://api.github.com/repos/edx/cs_comments_service/stargazers","contributors_url":"https://api.github.com/repos/edx/cs_comments_service/contributors","subscribers_url":"https://api.github.com/repos/edx/cs_comments_service/subscribers","subscription_url":"https://api.github.com/repos/edx/cs_comments_service/subscription","commits_url":"https://api.github.com/repos/edx/cs_comments_service/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/cs_comments_service/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/cs_comments_service/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/cs_comments_service/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/cs_comments_service/contents/{+path}","compare_url":"https://api.github.com/repos/edx/cs_comments_service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/cs_comments_service/merges","archive_url":"https://api.github.com/repos/edx/cs_comments_service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/cs_comments_service/downloads","issues_url":"https://api.github.com/repos/edx/cs_comments_service/issues{/number}","pulls_url":"https://api.github.com/repos/edx/cs_comments_service/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/cs_comments_service/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/cs_comments_service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/cs_comments_service/labels{/name}","releases_url":"https://api.github.com/repos/edx/cs_comments_service/releases{/id}","created_at":"2012-06-20T22:12:04Z","updated_at":"2015-11-15T05:05:32Z","pushed_at":"2016-01-12T07:03:26Z","git_url":"git://github.com/edx/cs_comments_service.git","ssh_url":"git@github.com:edx/cs_comments_service.git","clone_url":"https://github.com/edx/cs_comments_service.git","svn_url":"https://github.com/edx/cs_comments_service","homepage":null,"size":1566,"stargazers_count":24,"watchers_count":24,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":67,"mirror_url":null,"open_issues_count":10,"forks":67,"open_issues":10,"watchers":24,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"438cbbc416ec9ebb8bfc90aff742516917ea6070","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":4732120,"name":"cs_comments_service","full_name":"edx/cs_comments_service","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/cs_comments_service","description":"server side of the comment service","fork":false,"url":"https://api.github.com/repos/edx/cs_comments_service","forks_url":"https://api.github.com/repos/edx/cs_comments_service/forks","keys_url":"https://api.github.com/repos/edx/cs_comments_service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/cs_comments_service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/cs_comments_service/teams","hooks_url":"https://api.github.com/repos/edx/cs_comments_service/hooks","issue_events_url":"https://api.github.com/repos/edx/cs_comments_service/issues/events{/number}","events_url":"https://api.github.com/repos/edx/cs_comments_service/events","assignees_url":"https://api.github.com/repos/edx/cs_comments_service/assignees{/user}","branches_url":"https://api.github.com/repos/edx/cs_comments_service/branches{/branch}","tags_url":"https://api.github.com/repos/edx/cs_comments_service/tags","blobs_url":"https://api.github.com/repos/edx/cs_comments_service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/cs_comments_service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/cs_comments_service/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/cs_comments_service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/cs_comments_service/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/cs_comments_service/languages","stargazers_url":"https://api.github.com/repos/edx/cs_comments_service/stargazers","contributors_url":"https://api.github.com/repos/edx/cs_comments_service/contributors","subscribers_url":"https://api.github.com/repos/edx/cs_comments_service/subscribers","subscription_url":"https://api.github.com/repos/edx/cs_comments_service/subscription","commits_url":"https://api.github.com/repos/edx/cs_comments_service/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/cs_comments_service/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/cs_comments_service/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/cs_comments_service/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/cs_comments_service/contents/{+path}","compare_url":"https://api.github.com/repos/edx/cs_comments_service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/cs_comments_service/merges","archive_url":"https://api.github.com/repos/edx/cs_comments_service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/cs_comments_service/downloads","issues_url":"https://api.github.com/repos/edx/cs_comments_service/issues{/number}","pulls_url":"https://api.github.com/repos/edx/cs_comments_service/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/cs_comments_service/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/cs_comments_service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/cs_comments_service/labels{/name}","releases_url":"https://api.github.com/repos/edx/cs_comments_service/releases{/id}","created_at":"2012-06-20T22:12:04Z","updated_at":"2015-11-15T05:05:32Z","pushed_at":"2016-01-12T07:03:26Z","git_url":"git://github.com/edx/cs_comments_service.git","ssh_url":"git@github.com:edx/cs_comments_service.git","clone_url":"https://github.com/edx/cs_comments_service.git","svn_url":"https://github.com/edx/cs_comments_service","homepage":null,"size":1566,"stargazers_count":24,"watchers_count":24,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":67,"mirror_url":null,"open_issues_count":10,"forks":67,"open_issues":10,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/cs_comments_service/pulls/175"},"html":{"href":"https://github.com/edx/cs_comments_service/pull/175"},"issue":{"href":"https://api.github.com/repos/edx/cs_comments_service/issues/175"},"comments":{"href":"https://api.github.com/repos/edx/cs_comments_service/issues/175/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/cs_comments_service/pulls/175/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/cs_comments_service/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/cs_comments_service/pulls/175/commits"},"statuses":{"href":"https://api.github.com/repos/edx/cs_comments_service/statuses/78413a59654b83a190be6b2127fc7293b2c3239c"}}}}