{"action":"opened","issue":{"url":"https://api.github.com/repos/biggora/caminte/issues/51","labels_url":"https://api.github.com/repos/biggora/caminte/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/biggora/caminte/issues/51/comments","events_url":"https://api.github.com/repos/biggora/caminte/issues/51/events","html_url":"https://github.com/biggora/caminte/issues/51","id":88490666,"number":51,"title":"Finding objects from relations/setup relations","user":{"login":"thibautrey","id":1433921,"avatar_url":"https://avatars.githubusercontent.com/u/1433921?v=3","gravatar_id":"","url":"https://api.github.com/users/thibautrey","html_url":"https://github.com/thibautrey","followers_url":"https://api.github.com/users/thibautrey/followers","following_url":"https://api.github.com/users/thibautrey/following{/other_user}","gists_url":"https://api.github.com/users/thibautrey/gists{/gist_id}","starred_url":"https://api.github.com/users/thibautrey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thibautrey/subscriptions","organizations_url":"https://api.github.com/users/thibautrey/orgs","repos_url":"https://api.github.com/users/thibautrey/repos","events_url":"https://api.github.com/users/thibautrey/events{/privacy}","received_events_url":"https://api.github.com/users/thibautrey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-15T17:32:11Z","updated_at":"2015-06-15T17:32:11Z","closed_at":null,"body":"Hi everyone,\r\n\r\nI have been trying 2 for days to figure the way the relations work with Caminte and I can't figure out. \r\n\r\nI have the following Models : \r\n\r\nvar Class1 = schema.define(className, {\r\n    objectId          : { type: schema.String, unique: true, index: true },\r\n    createdAt         : { type: schema.Date,                 index: true },\r\n    updatedAt         : { type: schema.Date,                 index: true }\r\n}, {\r\n    primaryKeys: [\"objectId\"]\r\n});\r\n\r\n///// RELATIONS /////\r\nClass1.hasMany(OtherClass,  {as: 'otherclasses',  foreignKey: \"objectId\"});\r\n\r\nvar Class2 = schema.define(className, {\r\n    objectId          : { type: schema.String, unique: true, index: true },\r\n    createdAt         : { type: schema.Date,                 index: true },\r\n    updatedAt         : { type: schema.Date,                 index: true }\r\n}, {\r\n    primaryKeys: [\"objectId\"]\r\n});\r\n\r\n\r\nI would like to be able to query all the objects in \"otherclasses\".\r\nI'm trying this way : but obviously it doesn't sound to be the right way : \r\nvar query = instanceOfClass1.otherclasses.find();\r\n      query.run({}, function(err, results){\r\n      });\r\n\r\nCan anyone help me out with that ?"}}