{"action":"created","comment":{"url":"https://api.github.com/repos/clearlydefined/service/pulls/comments/222478906","pull_request_review_id":161376652,"id":222478906,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMjQ3ODkwNg==","diff_hunk":"@@ -0,0 +1,66 @@\n+// Copyright (c) Microsoft Corporation and others. Licensed under the MIT license.\n+// SPDX-License-Identifier: MIT\n+\n+const MongoClient = require('mongodb').MongoClient\n+const promiseRetry = require('promise-retry')\n+const EntityCoordinates = require('../../lib/entityCoordinates')\n+\n+class MongoStore {\n+  constructor(options) {\n+    this.options = options\n+  }\n+\n+  initialize() {\n+    return promiseRetry(async retry => {\n+      try {\n+        this.client = await MongoClient.connect(\n+          this.options.connectionString,\n+          { useNewUrlParser: true }\n+        )\n+        this.db = this.client.db(this.options.dbName)\n+        this.collection = this.db.collection('definitions')\n+      } catch (error) {\n+        retry(error)\n+      }\n+    })\n+  }\n+\n+  /**\n+   * List all of the matching components for the given coordinates.\n+   * Accepts partial coordinates.\n+   *\n+   * @param {EntityCoordinates} coordinates\n+   * @returns A list of matching coordinates i.e. [ 'npm/npmjs/-/JSONStream/1.3.3' ]\n+   */\n+  async list(coordinates) {\n+    const list = await this.collection.find({ id: this._getId(coordinates) }, 'id')","path":"providers/stores/mongo.js","position":36,"original_position":36,"commit_id":"9f6f415d255f21a88bef904d5c67c6665c68be95","original_commit_id":"9f6f415d255f21a88bef904d5c67c6665c68be95","user":{"login":"dabutvin","id":5168796,"node_id":"MDQ6VXNlcjUxNjg3OTY=","avatar_url":"https://avatars2.githubusercontent.com/u/5168796?v=4","gravatar_id":"","url":"https://api.github.com/users/dabutvin","html_url":"https://github.com/dabutvin","followers_url":"https://api.github.com/users/dabutvin/followers","following_url":"https://api.github.com/users/dabutvin/following{/other_user}","gists_url":"https://api.github.com/users/dabutvin/gists{/gist_id}","starred_url":"https://api.github.com/users/dabutvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dabutvin/subscriptions","organizations_url":"https://api.github.com/users/dabutvin/orgs","repos_url":"https://api.github.com/users/dabutvin/repos","events_url":"https://api.github.com/users/dabutvin/events{/privacy}","received_events_url":"https://api.github.com/users/dabutvin/received_events","type":"User","site_admin":false},"body":"this needs to be update to list by prefix, something like:\r\n\r\n```js\r\nawait this.collection.find({ id: new RegExp('^' + this._getId(coordinates) }, 'id')\r\n```","created_at":"2018-10-03T21:48:12Z","updated_at":"2018-10-03T21:48:12Z","html_url":"https://github.com/clearlydefined/service/pull/242#discussion_r222478906","pull_request_url":"https://api.github.com/repos/clearlydefined/service/pulls/242","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/clearlydefined/service/pulls/comments/222478906"},"html":{"href":"https://github.com/clearlydefined/service/pull/242#discussion_r222478906"},"pull_request":{"href":"https://api.github.com/repos/clearlydefined/service/pulls/242"}}},"pull_request":{"url":"https://api.github.com/repos/clearlydefined/service/pulls/242","id":219259108,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5MjU5MTA4","html_url":"https://github.com/clearlydefined/service/pull/242","diff_url":"https://github.com/clearlydefined/service/pull/242.diff","patch_url":"https://github.com/clearlydefined/service/pull/242.patch","issue_url":"https://api.github.com/repos/clearlydefined/service/issues/242","number":242,"state":"open","locked":false,"title":"WIP: massive refactor of providers and add mongo support","user":{"login":"jeffmcaffer","id":10070956,"node_id":"MDQ6VXNlcjEwMDcwOTU2","avatar_url":"https://avatars2.githubusercontent.com/u/10070956?v=4","gravatar_id":"","url":"https://api.github.com/users/jeffmcaffer","html_url":"https://github.com/jeffmcaffer","followers_url":"https://api.github.com/users/jeffmcaffer/followers","following_url":"https://api.github.com/users/jeffmcaffer/following{/other_user}","gists_url":"https://api.github.com/users/jeffmcaffer/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffmcaffer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffmcaffer/subscriptions","organizations_url":"https://api.github.com/users/jeffmcaffer/orgs","repos_url":"https://api.github.com/users/jeffmcaffer/repos","events_url":"https://api.github.com/users/jeffmcaffer/events{/privacy}","received_events_url":"https://api.github.com/users/jeffmcaffer/received_events","type":"User","site_admin":false},"body":"This a pretty big change that was unfortunately hard to tease apart.\r\n\r\n* Added support for mongo as a definition store\r\n* That resulted in a review of the store api as we had previously mixed up the harvest and definitions stores (as they were both always using the same provider, file or azblob).\r\n* That resulted in a review of the config structure and a rationalization of the how providers are plugged in\r\n* That resulted in tweaks to the app construction\r\n* Various bits of the above resulted in refactoring/restructuring of related tests\r\n* net result is quite a bit of change\r\n\r\nStill to do:\r\n* Attachments store -- stubbed but not implemented. need to decide if that will be a fully separate store or just an api on the definition store (leaning towards the former)\r\n* More testing of the individual providers (especially the azure based ones)\r\n","created_at":"2018-10-01T04:50:37Z","updated_at":"2018-10-03T21:48:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f32936b438e0bcc7077bd7596c0add3421e8f854","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/clearlydefined/service/pulls/242/commits","review_comments_url":"https://api.github.com/repos/clearlydefined/service/pulls/242/comments","review_comment_url":"https://api.github.com/repos/clearlydefined/service/pulls/comments{/number}","comments_url":"https://api.github.com/repos/clearlydefined/service/issues/242/comments","statuses_url":"https://api.github.com/repos/clearlydefined/service/statuses/9f6f415d255f21a88bef904d5c67c6665c68be95","head":{"label":"clearlydefined:jm/cosmos","ref":"jm/cosmos","sha":"9f6f415d255f21a88bef904d5c67c6665c68be95","user":{"login":"clearlydefined","id":34137144,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0MTM3MTQ0","avatar_url":"https://avatars2.githubusercontent.com/u/34137144?v=4","gravatar_id":"","url":"https://api.github.com/users/clearlydefined","html_url":"https://github.com/clearlydefined","followers_url":"https://api.github.com/users/clearlydefined/followers","following_url":"https://api.github.com/users/clearlydefined/following{/other_user}","gists_url":"https://api.github.com/users/clearlydefined/gists{/gist_id}","starred_url":"https://api.github.com/users/clearlydefined/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clearlydefined/subscriptions","organizations_url":"https://api.github.com/users/clearlydefined/orgs","repos_url":"https://api.github.com/users/clearlydefined/repos","events_url":"https://api.github.com/users/clearlydefined/events{/privacy}","received_events_url":"https://api.github.com/users/clearlydefined/received_events","type":"Organization","site_admin":false},"repo":{"id":113903008,"node_id":"MDEwOlJlcG9zaXRvcnkxMTM5MDMwMDg=","name":"service","full_name":"clearlydefined/service","private":false,"owner":{"login":"clearlydefined","id":34137144,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0MTM3MTQ0","avatar_url":"https://avatars2.githubusercontent.com/u/34137144?v=4","gravatar_id":"","url":"https://api.github.com/users/clearlydefined","html_url":"https://github.com/clearlydefined","followers_url":"https://api.github.com/users/clearlydefined/followers","following_url":"https://api.github.com/users/clearlydefined/following{/other_user}","gists_url":"https://api.github.com/users/clearlydefined/gists{/gist_id}","starred_url":"https://api.github.com/users/clearlydefined/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clearlydefined/subscriptions","organizations_url":"https://api.github.com/users/clearlydefined/orgs","repos_url":"https://api.github.com/users/clearlydefined/repos","events_url":"https://api.github.com/users/clearlydefined/events{/privacy}","received_events_url":"https://api.github.com/users/clearlydefined/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/clearlydefined/service","description":"The service side of clearlydefined.io","fork":false,"url":"https://api.github.com/repos/clearlydefined/service","forks_url":"https://api.github.com/repos/clearlydefined/service/forks","keys_url":"https://api.github.com/repos/clearlydefined/service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clearlydefined/service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clearlydefined/service/teams","hooks_url":"https://api.github.com/repos/clearlydefined/service/hooks","issue_events_url":"https://api.github.com/repos/clearlydefined/service/issues/events{/number}","events_url":"https://api.github.com/repos/clearlydefined/service/events","assignees_url":"https://api.github.com/repos/clearlydefined/service/assignees{/user}","branches_url":"https://api.github.com/repos/clearlydefined/service/branches{/branch}","tags_url":"https://api.github.com/repos/clearlydefined/service/tags","blobs_url":"https://api.github.com/repos/clearlydefined/service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clearlydefined/service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clearlydefined/service/git/refs{/sha}","trees_url":"https://api.github.com/repos/clearlydefined/service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clearlydefined/service/statuses/{sha}","languages_url":"https://api.github.com/repos/clearlydefined/service/languages","stargazers_url":"https://api.github.com/repos/clearlydefined/service/stargazers","contributors_url":"https://api.github.com/repos/clearlydefined/service/contributors","subscribers_url":"https://api.github.com/repos/clearlydefined/service/subscribers","subscription_url":"https://api.github.com/repos/clearlydefined/service/subscription","commits_url":"https://api.github.com/repos/clearlydefined/service/commits{/sha}","git_commits_url":"https://api.github.com/repos/clearlydefined/service/git/commits{/sha}","comments_url":"https://api.github.com/repos/clearlydefined/service/comments{/number}","issue_comment_url":"https://api.github.com/repos/clearlydefined/service/issues/comments{/number}","contents_url":"https://api.github.com/repos/clearlydefined/service/contents/{+path}","compare_url":"https://api.github.com/repos/clearlydefined/service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clearlydefined/service/merges","archive_url":"https://api.github.com/repos/clearlydefined/service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clearlydefined/service/downloads","issues_url":"https://api.github.com/repos/clearlydefined/service/issues{/number}","pulls_url":"https://api.github.com/repos/clearlydefined/service/pulls{/number}","milestones_url":"https://api.github.com/repos/clearlydefined/service/milestones{/number}","notifications_url":"https://api.github.com/repos/clearlydefined/service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clearlydefined/service/labels{/name}","releases_url":"https://api.github.com/repos/clearlydefined/service/releases{/id}","deployments_url":"https://api.github.com/repos/clearlydefined/service/deployments","created_at":"2017-12-11T20:04:11Z","updated_at":"2018-09-25T05:40:21Z","pushed_at":"2018-10-03T21:17:55Z","git_url":"git://github.com/clearlydefined/service.git","ssh_url":"git@github.com:clearlydefined/service.git","clone_url":"https://github.com/clearlydefined/service.git","svn_url":"https://github.com/clearlydefined/service","homepage":null,"size":778,"stargazers_count":11,"watchers_count":11,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"archived":false,"open_issues_count":31,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":13,"open_issues":31,"watchers":11,"default_branch":"master"}},"base":{"label":"clearlydefined:master","ref":"master","sha":"3133728b3f6e5d1eeba2d5288c1d186476a6a74a","user":{"login":"clearlydefined","id":34137144,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0MTM3MTQ0","avatar_url":"https://avatars2.githubusercontent.com/u/34137144?v=4","gravatar_id":"","url":"https://api.github.com/users/clearlydefined","html_url":"https://github.com/clearlydefined","followers_url":"https://api.github.com/users/clearlydefined/followers","following_url":"https://api.github.com/users/clearlydefined/following{/other_user}","gists_url":"https://api.github.com/users/clearlydefined/gists{/gist_id}","starred_url":"https://api.github.com/users/clearlydefined/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clearlydefined/subscriptions","organizations_url":"https://api.github.com/users/clearlydefined/orgs","repos_url":"https://api.github.com/users/clearlydefined/repos","events_url":"https://api.github.com/users/clearlydefined/events{/privacy}","received_events_url":"https://api.github.com/users/clearlydefined/received_events","type":"Organization","site_admin":false},"repo":{"id":113903008,"node_id":"MDEwOlJlcG9zaXRvcnkxMTM5MDMwMDg=","name":"service","full_name":"clearlydefined/service","private":false,"owner":{"login":"clearlydefined","id":34137144,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0MTM3MTQ0","avatar_url":"https://avatars2.githubusercontent.com/u/34137144?v=4","gravatar_id":"","url":"https://api.github.com/users/clearlydefined","html_url":"https://github.com/clearlydefined","followers_url":"https://api.github.com/users/clearlydefined/followers","following_url":"https://api.github.com/users/clearlydefined/following{/other_user}","gists_url":"https://api.github.com/users/clearlydefined/gists{/gist_id}","starred_url":"https://api.github.com/users/clearlydefined/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clearlydefined/subscriptions","organizations_url":"https://api.github.com/users/clearlydefined/orgs","repos_url":"https://api.github.com/users/clearlydefined/repos","events_url":"https://api.github.com/users/clearlydefined/events{/privacy}","received_events_url":"https://api.github.com/users/clearlydefined/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/clearlydefined/service","description":"The service side of clearlydefined.io","fork":false,"url":"https://api.github.com/repos/clearlydefined/service","forks_url":"https://api.github.com/repos/clearlydefined/service/forks","keys_url":"https://api.github.com/repos/clearlydefined/service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clearlydefined/service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clearlydefined/service/teams","hooks_url":"https://api.github.com/repos/clearlydefined/service/hooks","issue_events_url":"https://api.github.com/repos/clearlydefined/service/issues/events{/number}","events_url":"https://api.github.com/repos/clearlydefined/service/events","assignees_url":"https://api.github.com/repos/clearlydefined/service/assignees{/user}","branches_url":"https://api.github.com/repos/clearlydefined/service/branches{/branch}","tags_url":"https://api.github.com/repos/clearlydefined/service/tags","blobs_url":"https://api.github.com/repos/clearlydefined/service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clearlydefined/service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clearlydefined/service/git/refs{/sha}","trees_url":"https://api.github.com/repos/clearlydefined/service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clearlydefined/service/statuses/{sha}","languages_url":"https://api.github.com/repos/clearlydefined/service/languages","stargazers_url":"https://api.github.com/repos/clearlydefined/service/stargazers","contributors_url":"https://api.github.com/repos/clearlydefined/service/contributors","subscribers_url":"https://api.github.com/repos/clearlydefined/service/subscribers","subscription_url":"https://api.github.com/repos/clearlydefined/service/subscription","commits_url":"https://api.github.com/repos/clearlydefined/service/commits{/sha}","git_commits_url":"https://api.github.com/repos/clearlydefined/service/git/commits{/sha}","comments_url":"https://api.github.com/repos/clearlydefined/service/comments{/number}","issue_comment_url":"https://api.github.com/repos/clearlydefined/service/issues/comments{/number}","contents_url":"https://api.github.com/repos/clearlydefined/service/contents/{+path}","compare_url":"https://api.github.com/repos/clearlydefined/service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clearlydefined/service/merges","archive_url":"https://api.github.com/repos/clearlydefined/service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clearlydefined/service/downloads","issues_url":"https://api.github.com/repos/clearlydefined/service/issues{/number}","pulls_url":"https://api.github.com/repos/clearlydefined/service/pulls{/number}","milestones_url":"https://api.github.com/repos/clearlydefined/service/milestones{/number}","notifications_url":"https://api.github.com/repos/clearlydefined/service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clearlydefined/service/labels{/name}","releases_url":"https://api.github.com/repos/clearlydefined/service/releases{/id}","deployments_url":"https://api.github.com/repos/clearlydefined/service/deployments","created_at":"2017-12-11T20:04:11Z","updated_at":"2018-09-25T05:40:21Z","pushed_at":"2018-10-03T21:17:55Z","git_url":"git://github.com/clearlydefined/service.git","ssh_url":"git@github.com:clearlydefined/service.git","clone_url":"https://github.com/clearlydefined/service.git","svn_url":"https://github.com/clearlydefined/service","homepage":null,"size":778,"stargazers_count":11,"watchers_count":11,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"archived":false,"open_issues_count":31,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":13,"open_issues":31,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/clearlydefined/service/pulls/242"},"html":{"href":"https://github.com/clearlydefined/service/pull/242"},"issue":{"href":"https://api.github.com/repos/clearlydefined/service/issues/242"},"comments":{"href":"https://api.github.com/repos/clearlydefined/service/issues/242/comments"},"review_comments":{"href":"https://api.github.com/repos/clearlydefined/service/pulls/242/comments"},"review_comment":{"href":"https://api.github.com/repos/clearlydefined/service/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/clearlydefined/service/pulls/242/commits"},"statuses":{"href":"https://api.github.com/repos/clearlydefined/service/statuses/9f6f415d255f21a88bef904d5c67c6665c68be95"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"dabutvin"}}