{"action":"created","issue":{"url":"https://api.github.com/repos/strongloop/loopback-datasource-juggler/issues/622","labels_url":"https://api.github.com/repos/strongloop/loopback-datasource-juggler/issues/622/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/loopback-datasource-juggler/issues/622/comments","events_url":"https://api.github.com/repos/strongloop/loopback-datasource-juggler/issues/622/events","html_url":"https://github.com/strongloop/loopback-datasource-juggler/issues/622","id":87039924,"number":622,"title":"Include of referencesMany issues (after include refactoring)","user":{"login":"fabien","id":2749,"avatar_url":"https://avatars.githubusercontent.com/u/2749?v=3","gravatar_id":"","url":"https://api.github.com/users/fabien","html_url":"https://github.com/fabien","followers_url":"https://api.github.com/users/fabien/followers","following_url":"https://api.github.com/users/fabien/following{/other_user}","gists_url":"https://api.github.com/users/fabien/gists{/gist_id}","starred_url":"https://api.github.com/users/fabien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabien/subscriptions","organizations_url":"https://api.github.com/users/fabien/orgs","repos_url":"https://api.github.com/users/fabien/repos","events_url":"https://api.github.com/users/fabien/events{/privacy}","received_events_url":"https://api.github.com/users/fabien/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-10T17:09:49Z","updated_at":"2015-06-11T10:32:47Z","closed_at":null,"body":"One of the key aspects of a referencesMany relation is that it should keep the order of the ids when inclusion fetches them. Effectively `findByIds` (here https://github.com/strongloop/loopback-datasource-juggler/blob/master/lib/relation-definition.js#L2966) makes sure that this is the case.\r\n\r\nHowever, the refactoring here https://github.com/strongloop/loopback-datasource-juggler/commit/d009557a76cc8fe39314c2c1f1b4cdfe2520b4e2 does not take this into account.\r\n\r\nI'm currently investigating other possibly include-related issues, as I now have many failing tests after this particular commit. \r\n\r\n/cc @raymondfeng "},"comment":{"url":"https://api.github.com/repos/strongloop/loopback-datasource-juggler/issues/comments/111080828","html_url":"https://github.com/strongloop/loopback-datasource-juggler/issues/622#issuecomment-111080828","issue_url":"https://api.github.com/repos/strongloop/loopback-datasource-juggler/issues/622","id":111080828,"user":{"login":"fabien","id":2749,"avatar_url":"https://avatars.githubusercontent.com/u/2749?v=3","gravatar_id":"","url":"https://api.github.com/users/fabien","html_url":"https://github.com/fabien","followers_url":"https://api.github.com/users/fabien/followers","following_url":"https://api.github.com/users/fabien/following{/other_user}","gists_url":"https://api.github.com/users/fabien/gists{/gist_id}","starred_url":"https://api.github.com/users/fabien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabien/subscriptions","organizations_url":"https://api.github.com/users/fabien/orgs","repos_url":"https://api.github.com/users/fabien/repos","events_url":"https://api.github.com/users/fabien/events{/privacy}","received_events_url":"https://api.github.com/users/fabien/received_events","type":"User","site_admin":false},"created_at":"2015-06-11T10:32:47Z","updated_at":"2015-06-11T10:32:47Z","body":"@ningsuhen please see #625 - perhaps we can come to a solution like that; the tests now pass. Even if we don't implement a `contains` operator, the new `linkManyToOne` implementation should safely handle it automatically in case of MongoDB. So it would be great to consider this change anyway."}}