{"action":"opened","issue":{"url":"https://api.github.com/repos/jashkenas/backbone/issues/3712","labels_url":"https://api.github.com/repos/jashkenas/backbone/issues/3712/labels{/name}","comments_url":"https://api.github.com/repos/jashkenas/backbone/issues/3712/comments","events_url":"https://api.github.com/repos/jashkenas/backbone/issues/3712/events","html_url":"https://github.com/jashkenas/backbone/issues/3712","id":94852332,"number":3712,"title":"Collection set: when one model's cid == another model's id","user":{"login":"raymond-lam","id":13293035,"avatar_url":"https://avatars.githubusercontent.com/u/13293035?v=3","gravatar_id":"","url":"https://api.github.com/users/raymond-lam","html_url":"https://github.com/raymond-lam","followers_url":"https://api.github.com/users/raymond-lam/followers","following_url":"https://api.github.com/users/raymond-lam/following{/other_user}","gists_url":"https://api.github.com/users/raymond-lam/gists{/gist_id}","starred_url":"https://api.github.com/users/raymond-lam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raymond-lam/subscriptions","organizations_url":"https://api.github.com/users/raymond-lam/orgs","repos_url":"https://api.github.com/users/raymond-lam/repos","events_url":"https://api.github.com/users/raymond-lam/events{/privacy}","received_events_url":"https://api.github.com/users/raymond-lam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-14T02:17:06Z","updated_at":"2015-07-14T02:17:06Z","closed_at":null,"body":"Given the following code:\r\n\r\n```javascript\r\nvar model1 = new Backbone.Model({\r\n  id: 'foo'\r\n});\r\nvar model2 = new Backbone.Model({\r\n  id: model1.cid\r\n});\r\n\r\nvar collection = new Backbone.Collection([model1]);\r\ncollection.set([model1, model2]);\r\n```\r\n\r\nThe result is that `collection` contains only `model1`. Also, oddly, `model1.id` is changed to its `cid`."}}