{"action":"created","issue":{"url":"https://api.github.com/repos/fuwaneko/loopback-connector-rethinkdb/issues/10","labels_url":"https://api.github.com/repos/fuwaneko/loopback-connector-rethinkdb/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/fuwaneko/loopback-connector-rethinkdb/issues/10/comments","events_url":"https://api.github.com/repos/fuwaneko/loopback-connector-rethinkdb/issues/10/events","html_url":"https://github.com/fuwaneko/loopback-connector-rethinkdb/issues/10","id":93516812,"number":10,"title":"include filter returns an undefined object instead of empty array","user":{"login":"trosen333","id":10126920,"avatar_url":"https://avatars.githubusercontent.com/u/10126920?v=3","gravatar_id":"","url":"https://api.github.com/users/trosen333","html_url":"https://github.com/trosen333","followers_url":"https://api.github.com/users/trosen333/followers","following_url":"https://api.github.com/users/trosen333/following{/other_user}","gists_url":"https://api.github.com/users/trosen333/gists{/gist_id}","starred_url":"https://api.github.com/users/trosen333/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trosen333/subscriptions","organizations_url":"https://api.github.com/users/trosen333/orgs","repos_url":"https://api.github.com/users/trosen333/repos","events_url":"https://api.github.com/users/trosen333/events{/privacy}","received_events_url":"https://api.github.com/users/trosen333/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-07-07T12:14:08Z","updated_at":"2015-08-13T16:36:23Z","closed_at":null,"body":"When using include filter for defined relation if none of the objects in database have ids for their relations defined an undefined object will be returned - which crashes server. it should instead return an empty array. \r\n\r\nSteps for reproduction:\r\n1. Clone https://github.com/svarogg/loopback-example-relations\r\n2. Configure some rethinkdb datasource in server/datasources.json. Make sure it contains the tables required for loopback to work. (in this case r.expr([\"User\", \"AccessToken\", \"ACL\", \"RoleMapping\", \"Role\", \"Customer\", \"Review\", \"Order\"]).forEach(r.tableCreate(r.row)))\r\n3. npm install && slc run\r\n4. Go to http://localhost:3000/explorer\r\n5. Set some access token\r\n6. Send request Reviews/Test\r\n7. See in console output: TypeError: Cannot read property 'length' of undefined\r\n\r\nControl:\r\n1. Change server/boot/sample.js. uncomment line 51 (ie add a Review object to the db that contains an orderID) :\r\n         Q.all([\r\n            ///uncomment the first review in order to resolve issue\r\n            Q.ninvoke(Review, \"create\", {product: 'Product1', star: 3, order: orderA}),\r\n            Q.ninvoke(Review, \"create\", {product: 'Product2', star: 2}),\r\n            Q.ninvoke(Review, \"create\", {product: 'Product5', star: 5})\r\n          ])\r\n2. Repeat steps 3-6 from reproduction\r\n3. Notice that console output has no errors and request returns all Review objects.\r\n\r\nThanks in advance for any assistance."},"comment":{"url":"https://api.github.com/repos/fuwaneko/loopback-connector-rethinkdb/issues/comments/130752848","html_url":"https://github.com/fuwaneko/loopback-connector-rethinkdb/issues/10#issuecomment-130752848","issue_url":"https://api.github.com/repos/fuwaneko/loopback-connector-rethinkdb/issues/10","id":130752848,"user":{"login":"perfectedTech","id":12545351,"avatar_url":"https://avatars.githubusercontent.com/u/12545351?v=3","gravatar_id":"","url":"https://api.github.com/users/perfectedTech","html_url":"https://github.com/perfectedTech","followers_url":"https://api.github.com/users/perfectedTech/followers","following_url":"https://api.github.com/users/perfectedTech/following{/other_user}","gists_url":"https://api.github.com/users/perfectedTech/gists{/gist_id}","starred_url":"https://api.github.com/users/perfectedTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/perfectedTech/subscriptions","organizations_url":"https://api.github.com/users/perfectedTech/orgs","repos_url":"https://api.github.com/users/perfectedTech/repos","events_url":"https://api.github.com/users/perfectedTech/events{/privacy}","received_events_url":"https://api.github.com/users/perfectedTech/received_events","type":"User","site_admin":false},"created_at":"2015-08-13T16:36:23Z","updated_at":"2015-08-13T16:36:23Z","body":"@bajtos - congratulations!"}}