neumino / thinky

JavaScript ORM for RethinkDB
http://justonepixel.com/thinky/
Other
1.12k stars 128 forks source link

Relations #644

Open kmashiki opened 6 years ago

kmashiki commented 6 years ago

For the A.hasOne(B, ...) relation, does this mean that A must have exactly one B or that A must have at most one B?

Also, For example, Post.hasOne(Geo, "geo", "geo_id", "associated.id"). User.hasOne(Geo, "geo", "geo_id", "associated.id"). School.hasOne(Geo, "geo", "geo_id", "associated.id"). How would you define the other direction of the relation? We basically want to say something like 'Geo.belongsTo(Post || User || School,' but are not sure of the syntax.