{"action":"created","issue":{"url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb/issues/258","repository_url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb","labels_url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb/issues/258/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb/issues/258/comments","events_url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb/issues/258/events","html_url":"https://github.com/strongloop/loopback-connector-mongodb/issues/258","id":160477004,"number":258,"title":"upsert performs updateAttributes","user":{"login":"Ijmir","id":5108651,"avatar_url":"https://avatars.githubusercontent.com/u/5108651?v=3","gravatar_id":"","url":"https://api.github.com/users/Ijmir","html_url":"https://github.com/Ijmir","followers_url":"https://api.github.com/users/Ijmir/followers","following_url":"https://api.github.com/users/Ijmir/following{/other_user}","gists_url":"https://api.github.com/users/Ijmir/gists{/gist_id}","starred_url":"https://api.github.com/users/Ijmir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ijmir/subscriptions","organizations_url":"https://api.github.com/users/Ijmir/orgs","repos_url":"https://api.github.com/users/Ijmir/repos","events_url":"https://api.github.com/users/Ijmir/events{/privacy}","received_events_url":"https://api.github.com/users/Ijmir/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb/labels/triage","name":"triage","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-06-15T17:17:47Z","updated_at":"2016-06-23T19:17:06Z","closed_at":null,"body":"standard loopback PUT(without id in path) performs update attributes instead of upsert. in the connector the update data params is mapped using $set in parseUpdateData function:\r\n```js\r\n{\r\n  $set:update_data\r\n}\r\n```\r\nthe result is updateAttributes on the query even if upsert flag is defined."},"comment":{"url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb/issues/comments/228155446","html_url":"https://github.com/strongloop/loopback-connector-mongodb/issues/258#issuecomment-228155446","issue_url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb/issues/258","id":228155446,"user":{"login":"Amir-61","id":10672146,"avatar_url":"https://avatars.githubusercontent.com/u/10672146?v=3","gravatar_id":"","url":"https://api.github.com/users/Amir-61","html_url":"https://github.com/Amir-61","followers_url":"https://api.github.com/users/Amir-61/followers","following_url":"https://api.github.com/users/Amir-61/following{/other_user}","gists_url":"https://api.github.com/users/Amir-61/gists{/gist_id}","starred_url":"https://api.github.com/users/Amir-61/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Amir-61/subscriptions","organizations_url":"https://api.github.com/users/Amir-61/orgs","repos_url":"https://api.github.com/users/Amir-61/repos","events_url":"https://api.github.com/users/Amir-61/events{/privacy}","received_events_url":"https://api.github.com/users/Amir-61/received_events","type":"User","site_admin":false},"created_at":"2016-06-23T19:17:06Z","updated_at":"2016-06-23T19:17:06Z","body":"Hey @Ijmir \r\nThis does not seem a bug to me! If you do not provide `id` in path, but you provide it in `data` object; that is used as the `id`, so in your examples for  PUT (no id in path), although you are not providing `id` in path, you provide `id` in `data` object, so thats why are they being treated as `update` part of `updateOrCreate`.\r\n\r\nThanks!"}}
{"actor":{"display_login":"Amir-61"}}