{"action":"created","comment":{"url":"https://api.github.com/repos/algolia/mongo-connector/pulls/comments/32261479","id":32261479,"diff_hunk":"@@ -250,7 +250,8 @@ def apply_update(self, doc, update_spec):\n                     doc[attr] = None\n         return doc\n \n-    def update(self, doc, update_spec, namespace = None, timestamp = None):\n+    def update(self, document_id, update_spec, namespace = None, timestamp = None):\n+        doc = self.index.getObject(str(document_id))","path":"mongo_connector/doc_managers/algolia_doc_manager.py","position":6,"original_position":6,"commit_id":"dd1a6e2a1c987d0fdd8b9cabee91f3c9a011eb03","original_commit_id":"dd1a6e2a1c987d0fdd8b9cabee91f3c9a011eb03","user":{"login":"Nagriar","id":2361099,"avatar_url":"https://avatars.githubusercontent.com/u/2361099?v=3","gravatar_id":"","url":"https://api.github.com/users/Nagriar","html_url":"https://github.com/Nagriar","followers_url":"https://api.github.com/users/Nagriar/followers","following_url":"https://api.github.com/users/Nagriar/following{/other_user}","gists_url":"https://api.github.com/users/Nagriar/gists{/gist_id}","starred_url":"https://api.github.com/users/Nagriar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nagriar/subscriptions","organizations_url":"https://api.github.com/users/Nagriar/orgs","repos_url":"https://api.github.com/users/Nagriar/repos","events_url":"https://api.github.com/users/Nagriar/events{/privacy}","received_events_url":"https://api.github.com/users/Nagriar/received_events","type":"User","site_admin":false},"body":"We already use the partial update to avoid the call to get the object, we also override the apply_update method to handle the deleted attributes so we can put an empty dict instead of the original doc.\r\n\r\nBut there is one corner case, If your data is not flat, the default function \"apply_update\" will raise an error if you try to modify a nested attribute because it won't be able to access it.\r\n\r\nWith the getObject, the connector will be really slow and the number of api call will double for the update.\r\n\r\n","created_at":"2015-06-11T20:00:59Z","updated_at":"2015-06-11T20:00:59Z","html_url":"https://github.com/algolia/mongo-connector/pull/8#discussion_r32261479","pull_request_url":"https://api.github.com/repos/algolia/mongo-connector/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/algolia/mongo-connector/pulls/comments/32261479"},"html":{"href":"https://github.com/algolia/mongo-connector/pull/8#discussion_r32261479"},"pull_request":{"href":"https://api.github.com/repos/algolia/mongo-connector/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/algolia/mongo-connector/pulls/8","id":37492229,"html_url":"https://github.com/algolia/mongo-connector/pull/8","diff_url":"https://github.com/algolia/mongo-connector/pull/8.diff","patch_url":"https://github.com/algolia/mongo-connector/pull/8.patch","issue_url":"https://api.github.com/repos/algolia/mongo-connector/issues/8","number":8,"state":"closed","locked":false,"title":"fixing algolia doc manager","user":{"login":"benjamine","id":384553,"avatar_url":"https://avatars.githubusercontent.com/u/384553?v=3","gravatar_id":"","url":"https://api.github.com/users/benjamine","html_url":"https://github.com/benjamine","followers_url":"https://api.github.com/users/benjamine/followers","following_url":"https://api.github.com/users/benjamine/following{/other_user}","gists_url":"https://api.github.com/users/benjamine/gists{/gist_id}","starred_url":"https://api.github.com/users/benjamine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjamine/subscriptions","organizations_url":"https://api.github.com/users/benjamine/orgs","repos_url":"https://api.github.com/users/benjamine/repos","events_url":"https://api.github.com/users/benjamine/events{/privacy}","received_events_url":"https://api.github.com/users/benjamine/received_events","type":"User","site_admin":false},"body":"I found these changes were needed for the algolia doc manager to work again with recent changes in the doc manager API (ie. some methods now receive the doc id instead of the doc itself)","created_at":"2015-06-11T18:12:09Z","updated_at":"2015-06-11T20:00:59Z","closed_at":"2015-06-11T19:34:16Z","merged_at":"2015-06-11T19:34:16Z","merge_commit_sha":"81d254b4d2ce83d65b890f4655d53cb797b9f3a8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/algolia/mongo-connector/pulls/8/commits","review_comments_url":"https://api.github.com/repos/algolia/mongo-connector/pulls/8/comments","review_comment_url":"https://api.github.com/repos/algolia/mongo-connector/pulls/comments{/number}","comments_url":"https://api.github.com/repos/algolia/mongo-connector/issues/8/comments","statuses_url":"https://api.github.com/repos/algolia/mongo-connector/statuses/dd1a6e2a1c987d0fdd8b9cabee91f3c9a011eb03","head":{"label":"orchardmile:algolia","ref":"algolia","sha":"dd1a6e2a1c987d0fdd8b9cabee91f3c9a011eb03","user":{"login":"orchardmile","id":10030948,"avatar_url":"https://avatars.githubusercontent.com/u/10030948?v=3","gravatar_id":"","url":"https://api.github.com/users/orchardmile","html_url":"https://github.com/orchardmile","followers_url":"https://api.github.com/users/orchardmile/followers","following_url":"https://api.github.com/users/orchardmile/following{/other_user}","gists_url":"https://api.github.com/users/orchardmile/gists{/gist_id}","starred_url":"https://api.github.com/users/orchardmile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orchardmile/subscriptions","organizations_url":"https://api.github.com/users/orchardmile/orgs","repos_url":"https://api.github.com/users/orchardmile/repos","events_url":"https://api.github.com/users/orchardmile/events{/privacy}","received_events_url":"https://api.github.com/users/orchardmile/received_events","type":"Organization","site_admin":false},"repo":{"id":37272567,"name":"mongo-connector","full_name":"orchardmile/mongo-connector","owner":{"login":"orchardmile","id":10030948,"avatar_url":"https://avatars.githubusercontent.com/u/10030948?v=3","gravatar_id":"","url":"https://api.github.com/users/orchardmile","html_url":"https://github.com/orchardmile","followers_url":"https://api.github.com/users/orchardmile/followers","following_url":"https://api.github.com/users/orchardmile/following{/other_user}","gists_url":"https://api.github.com/users/orchardmile/gists{/gist_id}","starred_url":"https://api.github.com/users/orchardmile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orchardmile/subscriptions","organizations_url":"https://api.github.com/users/orchardmile/orgs","repos_url":"https://api.github.com/users/orchardmile/repos","events_url":"https://api.github.com/users/orchardmile/events{/privacy}","received_events_url":"https://api.github.com/users/orchardmile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/orchardmile/mongo-connector","description":"","fork":true,"url":"https://api.github.com/repos/orchardmile/mongo-connector","forks_url":"https://api.github.com/repos/orchardmile/mongo-connector/forks","keys_url":"https://api.github.com/repos/orchardmile/mongo-connector/keys{/key_id}","collaborators_url":"https://api.github.com/repos/orchardmile/mongo-connector/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/orchardmile/mongo-connector/teams","hooks_url":"https://api.github.com/repos/orchardmile/mongo-connector/hooks","issue_events_url":"https://api.github.com/repos/orchardmile/mongo-connector/issues/events{/number}","events_url":"https://api.github.com/repos/orchardmile/mongo-connector/events","assignees_url":"https://api.github.com/repos/orchardmile/mongo-connector/assignees{/user}","branches_url":"https://api.github.com/repos/orchardmile/mongo-connector/branches{/branch}","tags_url":"https://api.github.com/repos/orchardmile/mongo-connector/tags","blobs_url":"https://api.github.com/repos/orchardmile/mongo-connector/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/orchardmile/mongo-connector/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/orchardmile/mongo-connector/git/refs{/sha}","trees_url":"https://api.github.com/repos/orchardmile/mongo-connector/git/trees{/sha}","statuses_url":"https://api.github.com/repos/orchardmile/mongo-connector/statuses/{sha}","languages_url":"https://api.github.com/repos/orchardmile/mongo-connector/languages","stargazers_url":"https://api.github.com/repos/orchardmile/mongo-connector/stargazers","contributors_url":"https://api.github.com/repos/orchardmile/mongo-connector/contributors","subscribers_url":"https://api.github.com/repos/orchardmile/mongo-connector/subscribers","subscription_url":"https://api.github.com/repos/orchardmile/mongo-connector/subscription","commits_url":"https://api.github.com/repos/orchardmile/mongo-connector/commits{/sha}","git_commits_url":"https://api.github.com/repos/orchardmile/mongo-connector/git/commits{/sha}","comments_url":"https://api.github.com/repos/orchardmile/mongo-connector/comments{/number}","issue_comment_url":"https://api.github.com/repos/orchardmile/mongo-connector/issues/comments{/number}","contents_url":"https://api.github.com/repos/orchardmile/mongo-connector/contents/{+path}","compare_url":"https://api.github.com/repos/orchardmile/mongo-connector/compare/{base}...{head}","merges_url":"https://api.github.com/repos/orchardmile/mongo-connector/merges","archive_url":"https://api.github.com/repos/orchardmile/mongo-connector/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/orchardmile/mongo-connector/downloads","issues_url":"https://api.github.com/repos/orchardmile/mongo-connector/issues{/number}","pulls_url":"https://api.github.com/repos/orchardmile/mongo-connector/pulls{/number}","milestones_url":"https://api.github.com/repos/orchardmile/mongo-connector/milestones{/number}","notifications_url":"https://api.github.com/repos/orchardmile/mongo-connector/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/orchardmile/mongo-connector/labels{/name}","releases_url":"https://api.github.com/repos/orchardmile/mongo-connector/releases{/id}","created_at":"2015-06-11T16:25:47Z","updated_at":"2015-06-11T16:25:48Z","pushed_at":"2015-06-11T18:10:56Z","git_url":"git://github.com/orchardmile/mongo-connector.git","ssh_url":"git@github.com:orchardmile/mongo-connector.git","clone_url":"https://github.com/orchardmile/mongo-connector.git","svn_url":"https://github.com/orchardmile/mongo-connector","homepage":null,"size":1969,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"algolia"}},"base":{"label":"algolia:algolia","ref":"algolia","sha":"0a6944defa6c2f2d302daefd1738bf9c74785956","user":{"login":"algolia","id":2034458,"avatar_url":"https://avatars.githubusercontent.com/u/2034458?v=3","gravatar_id":"","url":"https://api.github.com/users/algolia","html_url":"https://github.com/algolia","followers_url":"https://api.github.com/users/algolia/followers","following_url":"https://api.github.com/users/algolia/following{/other_user}","gists_url":"https://api.github.com/users/algolia/gists{/gist_id}","starred_url":"https://api.github.com/users/algolia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/algolia/subscriptions","organizations_url":"https://api.github.com/users/algolia/orgs","repos_url":"https://api.github.com/users/algolia/repos","events_url":"https://api.github.com/users/algolia/events{/privacy}","received_events_url":"https://api.github.com/users/algolia/received_events","type":"Organization","site_admin":false},"repo":{"id":15813979,"name":"mongo-connector","full_name":"algolia/mongo-connector","owner":{"login":"algolia","id":2034458,"avatar_url":"https://avatars.githubusercontent.com/u/2034458?v=3","gravatar_id":"","url":"https://api.github.com/users/algolia","html_url":"https://github.com/algolia","followers_url":"https://api.github.com/users/algolia/followers","following_url":"https://api.github.com/users/algolia/following{/other_user}","gists_url":"https://api.github.com/users/algolia/gists{/gist_id}","starred_url":"https://api.github.com/users/algolia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/algolia/subscriptions","organizations_url":"https://api.github.com/users/algolia/orgs","repos_url":"https://api.github.com/users/algolia/repos","events_url":"https://api.github.com/users/algolia/events{/privacy}","received_events_url":"https://api.github.com/users/algolia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/algolia/mongo-connector","description":"","fork":true,"url":"https://api.github.com/repos/algolia/mongo-connector","forks_url":"https://api.github.com/repos/algolia/mongo-connector/forks","keys_url":"https://api.github.com/repos/algolia/mongo-connector/keys{/key_id}","collaborators_url":"https://api.github.com/repos/algolia/mongo-connector/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/algolia/mongo-connector/teams","hooks_url":"https://api.github.com/repos/algolia/mongo-connector/hooks","issue_events_url":"https://api.github.com/repos/algolia/mongo-connector/issues/events{/number}","events_url":"https://api.github.com/repos/algolia/mongo-connector/events","assignees_url":"https://api.github.com/repos/algolia/mongo-connector/assignees{/user}","branches_url":"https://api.github.com/repos/algolia/mongo-connector/branches{/branch}","tags_url":"https://api.github.com/repos/algolia/mongo-connector/tags","blobs_url":"https://api.github.com/repos/algolia/mongo-connector/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/algolia/mongo-connector/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/algolia/mongo-connector/git/refs{/sha}","trees_url":"https://api.github.com/repos/algolia/mongo-connector/git/trees{/sha}","statuses_url":"https://api.github.com/repos/algolia/mongo-connector/statuses/{sha}","languages_url":"https://api.github.com/repos/algolia/mongo-connector/languages","stargazers_url":"https://api.github.com/repos/algolia/mongo-connector/stargazers","contributors_url":"https://api.github.com/repos/algolia/mongo-connector/contributors","subscribers_url":"https://api.github.com/repos/algolia/mongo-connector/subscribers","subscription_url":"https://api.github.com/repos/algolia/mongo-connector/subscription","commits_url":"https://api.github.com/repos/algolia/mongo-connector/commits{/sha}","git_commits_url":"https://api.github.com/repos/algolia/mongo-connector/git/commits{/sha}","comments_url":"https://api.github.com/repos/algolia/mongo-connector/comments{/number}","issue_comment_url":"https://api.github.com/repos/algolia/mongo-connector/issues/comments{/number}","contents_url":"https://api.github.com/repos/algolia/mongo-connector/contents/{+path}","compare_url":"https://api.github.com/repos/algolia/mongo-connector/compare/{base}...{head}","merges_url":"https://api.github.com/repos/algolia/mongo-connector/merges","archive_url":"https://api.github.com/repos/algolia/mongo-connector/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/algolia/mongo-connector/downloads","issues_url":"https://api.github.com/repos/algolia/mongo-connector/issues{/number}","pulls_url":"https://api.github.com/repos/algolia/mongo-connector/pulls{/number}","milestones_url":"https://api.github.com/repos/algolia/mongo-connector/milestones{/number}","notifications_url":"https://api.github.com/repos/algolia/mongo-connector/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/algolia/mongo-connector/labels{/name}","releases_url":"https://api.github.com/repos/algolia/mongo-connector/releases{/id}","created_at":"2014-01-11T00:39:33Z","updated_at":"2015-03-21T13:39:08Z","pushed_at":"2015-06-11T19:34:16Z","git_url":"git://github.com/algolia/mongo-connector.git","ssh_url":"git@github.com:algolia/mongo-connector.git","clone_url":"https://github.com/algolia/mongo-connector.git","svn_url":"https://github.com/algolia/mongo-connector","homepage":null,"size":1969,"stargazers_count":13,"watchers_count":13,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":2,"forks":7,"open_issues":2,"watchers":13,"default_branch":"algolia"}},"_links":{"self":{"href":"https://api.github.com/repos/algolia/mongo-connector/pulls/8"},"html":{"href":"https://github.com/algolia/mongo-connector/pull/8"},"issue":{"href":"https://api.github.com/repos/algolia/mongo-connector/issues/8"},"comments":{"href":"https://api.github.com/repos/algolia/mongo-connector/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/algolia/mongo-connector/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/algolia/mongo-connector/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/algolia/mongo-connector/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/algolia/mongo-connector/statuses/dd1a6e2a1c987d0fdd8b9cabee91f3c9a011eb03"}}}}