{"action":"created","comment":{"url":"https://api.github.com/repos/meteorhacks/search-source/pulls/comments/27919303","id":27919303,"diff_hunk":"@@ -79,8 +79,14 @@ SearchSource.prototype._updateStore = function(data) {\n     self.store.update(item._id, item, {upsert: true});\n   });\n \n-  var removedItem = _.difference(storeIds, currentIds);\n-  removedItem.forEach(function(id) {\n+  // Remove items in client DB that we no longer need\n+  var currentIdStrs = _.map(currentIds, function(currentId){ \n+    return currentId._str; ","path":"lib/client.js","position":8,"original_position":8,"commit_id":"38cb9a78f34e28dd41023250da9ba0db90797e9c","original_commit_id":"38cb9a78f34e28dd41023250da9ba0db90797e9c","user":{"login":"arunoda","id":50838,"avatar_url":"https://avatars.githubusercontent.com/u/50838?v=3","gravatar_id":"","url":"https://api.github.com/users/arunoda","html_url":"https://github.com/arunoda","followers_url":"https://api.github.com/users/arunoda/followers","following_url":"https://api.github.com/users/arunoda/following{/other_user}","gists_url":"https://api.github.com/users/arunoda/gists{/gist_id}","starred_url":"https://api.github.com/users/arunoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arunoda/subscriptions","organizations_url":"https://api.github.com/users/arunoda/orgs","repos_url":"https://api.github.com/users/arunoda/repos","events_url":"https://api.github.com/users/arunoda/events{/privacy}","received_events_url":"https://api.github.com/users/arunoda/received_events","type":"User","site_admin":false},"body":"It's possible `currentId` to be just string. So, we need to check that as well.\r\nMay be try to use the `typeof` check.","created_at":"2015-04-07T20:54:11Z","updated_at":"2015-04-07T20:54:11Z","html_url":"https://github.com/meteorhacks/search-source/pull/16#discussion_r27919303","pull_request_url":"https://api.github.com/repos/meteorhacks/search-source/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/meteorhacks/search-source/pulls/comments/27919303"},"html":{"href":"https://github.com/meteorhacks/search-source/pull/16#discussion_r27919303"},"pull_request":{"href":"https://api.github.com/repos/meteorhacks/search-source/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/meteorhacks/search-source/pulls/16","id":32788970,"html_url":"https://github.com/meteorhacks/search-source/pull/16","diff_url":"https://github.com/meteorhacks/search-source/pull/16.diff","patch_url":"https://github.com/meteorhacks/search-source/pull/16.patch","issue_url":"https://api.github.com/repos/meteorhacks/search-source/issues/16","number":16,"state":"open","locked":false,"title":"Fixed a bug in SearchSource.prototype._updateStore. Resolves #7, #15","user":{"login":"woniesong92","id":2935309,"avatar_url":"https://avatars.githubusercontent.com/u/2935309?v=3","gravatar_id":"","url":"https://api.github.com/users/woniesong92","html_url":"https://github.com/woniesong92","followers_url":"https://api.github.com/users/woniesong92/followers","following_url":"https://api.github.com/users/woniesong92/following{/other_user}","gists_url":"https://api.github.com/users/woniesong92/gists{/gist_id}","starred_url":"https://api.github.com/users/woniesong92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woniesong92/subscriptions","organizations_url":"https://api.github.com/users/woniesong92/orgs","repos_url":"https://api.github.com/users/woniesong92/repos","events_url":"https://api.github.com/users/woniesong92/events{/privacy}","received_events_url":"https://api.github.com/users/woniesong92/received_events","type":"User","site_admin":false},"body":"The problem was `_.difference` was not working correctly to compare `id` objects. I fixed the issue by comparing `id strings` instead when deciding which items to remove from the client database.","created_at":"2015-04-07T17:59:41Z","updated_at":"2015-04-07T20:54:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf5bbc69ef2696d5b27cfe9b6c2cab30bc05ab1b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/meteorhacks/search-source/pulls/16/commits","review_comments_url":"https://api.github.com/repos/meteorhacks/search-source/pulls/16/comments","review_comment_url":"https://api.github.com/repos/meteorhacks/search-source/pulls/comments{/number}","comments_url":"https://api.github.com/repos/meteorhacks/search-source/issues/16/comments","statuses_url":"https://api.github.com/repos/meteorhacks/search-source/statuses/38cb9a78f34e28dd41023250da9ba0db90797e9c","head":{"label":"woniesong92:master","ref":"master","sha":"38cb9a78f34e28dd41023250da9ba0db90797e9c","user":{"login":"woniesong92","id":2935309,"avatar_url":"https://avatars.githubusercontent.com/u/2935309?v=3","gravatar_id":"","url":"https://api.github.com/users/woniesong92","html_url":"https://github.com/woniesong92","followers_url":"https://api.github.com/users/woniesong92/followers","following_url":"https://api.github.com/users/woniesong92/following{/other_user}","gists_url":"https://api.github.com/users/woniesong92/gists{/gist_id}","starred_url":"https://api.github.com/users/woniesong92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woniesong92/subscriptions","organizations_url":"https://api.github.com/users/woniesong92/orgs","repos_url":"https://api.github.com/users/woniesong92/repos","events_url":"https://api.github.com/users/woniesong92/events{/privacy}","received_events_url":"https://api.github.com/users/woniesong92/received_events","type":"User","site_admin":false},"repo":{"id":33555595,"name":"search-source","full_name":"woniesong92/search-source","owner":{"login":"woniesong92","id":2935309,"avatar_url":"https://avatars.githubusercontent.com/u/2935309?v=3","gravatar_id":"","url":"https://api.github.com/users/woniesong92","html_url":"https://github.com/woniesong92","followers_url":"https://api.github.com/users/woniesong92/followers","following_url":"https://api.github.com/users/woniesong92/following{/other_user}","gists_url":"https://api.github.com/users/woniesong92/gists{/gist_id}","starred_url":"https://api.github.com/users/woniesong92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woniesong92/subscriptions","organizations_url":"https://api.github.com/users/woniesong92/orgs","repos_url":"https://api.github.com/users/woniesong92/repos","events_url":"https://api.github.com/users/woniesong92/events{/privacy}","received_events_url":"https://api.github.com/users/woniesong92/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/woniesong92/search-source","description":"Reactive Data Source for Search","fork":true,"url":"https://api.github.com/repos/woniesong92/search-source","forks_url":"https://api.github.com/repos/woniesong92/search-source/forks","keys_url":"https://api.github.com/repos/woniesong92/search-source/keys{/key_id}","collaborators_url":"https://api.github.com/repos/woniesong92/search-source/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/woniesong92/search-source/teams","hooks_url":"https://api.github.com/repos/woniesong92/search-source/hooks","issue_events_url":"https://api.github.com/repos/woniesong92/search-source/issues/events{/number}","events_url":"https://api.github.com/repos/woniesong92/search-source/events","assignees_url":"https://api.github.com/repos/woniesong92/search-source/assignees{/user}","branches_url":"https://api.github.com/repos/woniesong92/search-source/branches{/branch}","tags_url":"https://api.github.com/repos/woniesong92/search-source/tags","blobs_url":"https://api.github.com/repos/woniesong92/search-source/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/woniesong92/search-source/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/woniesong92/search-source/git/refs{/sha}","trees_url":"https://api.github.com/repos/woniesong92/search-source/git/trees{/sha}","statuses_url":"https://api.github.com/repos/woniesong92/search-source/statuses/{sha}","languages_url":"https://api.github.com/repos/woniesong92/search-source/languages","stargazers_url":"https://api.github.com/repos/woniesong92/search-source/stargazers","contributors_url":"https://api.github.com/repos/woniesong92/search-source/contributors","subscribers_url":"https://api.github.com/repos/woniesong92/search-source/subscribers","subscription_url":"https://api.github.com/repos/woniesong92/search-source/subscription","commits_url":"https://api.github.com/repos/woniesong92/search-source/commits{/sha}","git_commits_url":"https://api.github.com/repos/woniesong92/search-source/git/commits{/sha}","comments_url":"https://api.github.com/repos/woniesong92/search-source/comments{/number}","issue_comment_url":"https://api.github.com/repos/woniesong92/search-source/issues/comments{/number}","contents_url":"https://api.github.com/repos/woniesong92/search-source/contents/{+path}","compare_url":"https://api.github.com/repos/woniesong92/search-source/compare/{base}...{head}","merges_url":"https://api.github.com/repos/woniesong92/search-source/merges","archive_url":"https://api.github.com/repos/woniesong92/search-source/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/woniesong92/search-source/downloads","issues_url":"https://api.github.com/repos/woniesong92/search-source/issues{/number}","pulls_url":"https://api.github.com/repos/woniesong92/search-source/pulls{/number}","milestones_url":"https://api.github.com/repos/woniesong92/search-source/milestones{/number}","notifications_url":"https://api.github.com/repos/woniesong92/search-source/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/woniesong92/search-source/labels{/name}","releases_url":"https://api.github.com/repos/woniesong92/search-source/releases{/id}","created_at":"2015-04-07T16:43:45Z","updated_at":"2015-04-07T17:57:47Z","pushed_at":"2015-04-07T17:57:47Z","git_url":"git://github.com/woniesong92/search-source.git","ssh_url":"git@github.com:woniesong92/search-source.git","clone_url":"https://github.com/woniesong92/search-source.git","svn_url":"https://github.com/woniesong92/search-source","homepage":"","size":294,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"meteorhacks:master","ref":"master","sha":"8af2d69c3339c2481743f845ccb7ff5ad2714e8a","user":{"login":"meteorhacks","id":4592287,"avatar_url":"https://avatars.githubusercontent.com/u/4592287?v=3","gravatar_id":"","url":"https://api.github.com/users/meteorhacks","html_url":"https://github.com/meteorhacks","followers_url":"https://api.github.com/users/meteorhacks/followers","following_url":"https://api.github.com/users/meteorhacks/following{/other_user}","gists_url":"https://api.github.com/users/meteorhacks/gists{/gist_id}","starred_url":"https://api.github.com/users/meteorhacks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meteorhacks/subscriptions","organizations_url":"https://api.github.com/users/meteorhacks/orgs","repos_url":"https://api.github.com/users/meteorhacks/repos","events_url":"https://api.github.com/users/meteorhacks/events{/privacy}","received_events_url":"https://api.github.com/users/meteorhacks/received_events","type":"Organization","site_admin":false},"repo":{"id":28386297,"name":"search-source","full_name":"meteorhacks/search-source","owner":{"login":"meteorhacks","id":4592287,"avatar_url":"https://avatars.githubusercontent.com/u/4592287?v=3","gravatar_id":"","url":"https://api.github.com/users/meteorhacks","html_url":"https://github.com/meteorhacks","followers_url":"https://api.github.com/users/meteorhacks/followers","following_url":"https://api.github.com/users/meteorhacks/following{/other_user}","gists_url":"https://api.github.com/users/meteorhacks/gists{/gist_id}","starred_url":"https://api.github.com/users/meteorhacks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meteorhacks/subscriptions","organizations_url":"https://api.github.com/users/meteorhacks/orgs","repos_url":"https://api.github.com/users/meteorhacks/repos","events_url":"https://api.github.com/users/meteorhacks/events{/privacy}","received_events_url":"https://api.github.com/users/meteorhacks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/meteorhacks/search-source","description":"Reactive Data Source for Search","fork":false,"url":"https://api.github.com/repos/meteorhacks/search-source","forks_url":"https://api.github.com/repos/meteorhacks/search-source/forks","keys_url":"https://api.github.com/repos/meteorhacks/search-source/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meteorhacks/search-source/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meteorhacks/search-source/teams","hooks_url":"https://api.github.com/repos/meteorhacks/search-source/hooks","issue_events_url":"https://api.github.com/repos/meteorhacks/search-source/issues/events{/number}","events_url":"https://api.github.com/repos/meteorhacks/search-source/events","assignees_url":"https://api.github.com/repos/meteorhacks/search-source/assignees{/user}","branches_url":"https://api.github.com/repos/meteorhacks/search-source/branches{/branch}","tags_url":"https://api.github.com/repos/meteorhacks/search-source/tags","blobs_url":"https://api.github.com/repos/meteorhacks/search-source/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meteorhacks/search-source/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meteorhacks/search-source/git/refs{/sha}","trees_url":"https://api.github.com/repos/meteorhacks/search-source/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meteorhacks/search-source/statuses/{sha}","languages_url":"https://api.github.com/repos/meteorhacks/search-source/languages","stargazers_url":"https://api.github.com/repos/meteorhacks/search-source/stargazers","contributors_url":"https://api.github.com/repos/meteorhacks/search-source/contributors","subscribers_url":"https://api.github.com/repos/meteorhacks/search-source/subscribers","subscription_url":"https://api.github.com/repos/meteorhacks/search-source/subscription","commits_url":"https://api.github.com/repos/meteorhacks/search-source/commits{/sha}","git_commits_url":"https://api.github.com/repos/meteorhacks/search-source/git/commits{/sha}","comments_url":"https://api.github.com/repos/meteorhacks/search-source/comments{/number}","issue_comment_url":"https://api.github.com/repos/meteorhacks/search-source/issues/comments{/number}","contents_url":"https://api.github.com/repos/meteorhacks/search-source/contents/{+path}","compare_url":"https://api.github.com/repos/meteorhacks/search-source/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meteorhacks/search-source/merges","archive_url":"https://api.github.com/repos/meteorhacks/search-source/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meteorhacks/search-source/downloads","issues_url":"https://api.github.com/repos/meteorhacks/search-source/issues{/number}","pulls_url":"https://api.github.com/repos/meteorhacks/search-source/pulls{/number}","milestones_url":"https://api.github.com/repos/meteorhacks/search-source/milestones{/number}","notifications_url":"https://api.github.com/repos/meteorhacks/search-source/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meteorhacks/search-source/labels{/name}","releases_url":"https://api.github.com/repos/meteorhacks/search-source/releases{/id}","created_at":"2014-12-23T08:15:29Z","updated_at":"2015-04-06T17:10:39Z","pushed_at":"2015-04-07T17:59:41Z","git_url":"git://github.com/meteorhacks/search-source.git","ssh_url":"git@github.com:meteorhacks/search-source.git","clone_url":"https://github.com/meteorhacks/search-source.git","svn_url":"https://github.com/meteorhacks/search-source","homepage":"","size":294,"stargazers_count":49,"watchers_count":49,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":13,"forks":6,"open_issues":13,"watchers":49,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/meteorhacks/search-source/pulls/16"},"html":{"href":"https://github.com/meteorhacks/search-source/pull/16"},"issue":{"href":"https://api.github.com/repos/meteorhacks/search-source/issues/16"},"comments":{"href":"https://api.github.com/repos/meteorhacks/search-source/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/meteorhacks/search-source/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/meteorhacks/search-source/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/meteorhacks/search-source/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/meteorhacks/search-source/statuses/38cb9a78f34e28dd41023250da9ba0db90797e9c"}}}}