{"action":"created","issue":{"url":"https://api.github.com/repos/strongloop/loopback/issues/2940","repository_url":"https://api.github.com/repos/strongloop/loopback","labels_url":"https://api.github.com/repos/strongloop/loopback/issues/2940/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/loopback/issues/2940/comments","events_url":"https://api.github.com/repos/strongloop/loopback/issues/2940/events","html_url":"https://github.com/strongloop/loopback/pull/2940","id":189284962,"number":2940,"title":"Add options to bulkUpdate","user":{"login":"kobaska","id":7113767,"avatar_url":"https://avatars.githubusercontent.com/u/7113767?v=3","gravatar_id":"","url":"https://api.github.com/users/kobaska","html_url":"https://github.com/kobaska","followers_url":"https://api.github.com/users/kobaska/followers","following_url":"https://api.github.com/users/kobaska/following{/other_user}","gists_url":"https://api.github.com/users/kobaska/gists{/gist_id}","starred_url":"https://api.github.com/users/kobaska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kobaska/subscriptions","organizations_url":"https://api.github.com/users/kobaska/orgs","repos_url":"https://api.github.com/users/kobaska/repos","events_url":"https://api.github.com/users/kobaska/events{/privacy}","received_events_url":"https://api.github.com/users/kobaska/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-15T02:42:47Z","updated_at":"2016-11-15T02:42:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/strongloop/loopback/pulls/2940","html_url":"https://github.com/strongloop/loopback/pull/2940","diff_url":"https://github.com/strongloop/loopback/pull/2940.diff","patch_url":"https://github.com/strongloop/loopback/pull/2940.patch"},"body":"### Description\r\n\r\nPassing options to bulkUpdate, so we can detect saves and updates during sync. Saves during sync can be identified by adding a property on options which gets passed into to replicate.\r\n\r\ne.g.:\r\nWhen you want to update last modified date column on each save through operation hooks, but not during sync:\r\n\r\n```\r\nvar options = {\r\n  sync: true,\r\n  ... other options\r\n}\r\n\r\nSomeModel.replicate(since, targetModel, options, callback);\r\n\r\nSomeModel.observe('before save', function updateLastModDate(ctx, next) {\r\nif (ctx.options.sync) {\r\n  // do not update\r\n} else {\r\n  // update\r\n}\r\n\r\nnext();\r\n});\r\n```\r\n\r\n#### Related issues\r\n\r\n- None\r\n\r\n### Checklist\r\n\r\n- [x] New tests added or existing tests modified to cover all changes\r\n- [x] Code conforms with the [style\r\n  guide](http://loopback.io/doc/en/contrib/style-guide.html)\r\n"},"comment":{"url":"https://api.github.com/repos/strongloop/loopback/issues/comments/260531309","html_url":"https://github.com/strongloop/loopback/pull/2940#issuecomment-260531309","issue_url":"https://api.github.com/repos/strongloop/loopback/issues/2940","id":260531309,"user":{"login":"slnode","id":3865961,"avatar_url":"https://avatars.githubusercontent.com/u/3865961?v=3","gravatar_id":"","url":"https://api.github.com/users/slnode","html_url":"https://github.com/slnode","followers_url":"https://api.github.com/users/slnode/followers","following_url":"https://api.github.com/users/slnode/following{/other_user}","gists_url":"https://api.github.com/users/slnode/gists{/gist_id}","starred_url":"https://api.github.com/users/slnode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slnode/subscriptions","organizations_url":"https://api.github.com/users/slnode/orgs","repos_url":"https://api.github.com/users/slnode/repos","events_url":"https://api.github.com/users/slnode/events{/privacy}","received_events_url":"https://api.github.com/users/slnode/received_events","type":"User","site_admin":false},"created_at":"2016-11-15T02:42:49Z","updated_at":"2016-11-15T02:42:49Z","body":"Can one of the admins verify this patch? To accept patch and trigger a build add comment \".*ok\\W+to\\W+test.*\""}}
{"actor":{"display_login":"slnode"}}