dresende / node-orm2

Object Relational Mapping
http://github.com/dresende/node-orm2
MIT License
3.07k stars 379 forks source link

cannot declare a (employee_id, job_id, client_id) n,n,n relation ? #621

Closed kapouer closed 9 years ago

kapouer commented 9 years ago

Is this an inherent limitation of the hasOne / hasMany semantics ?

Wouldn't it be simpler and less restrictive to be able to use a Model has a field of another Model, like so:

hasOne Job:

var Employee = db.define("employee", {
    name    : { type: "text", size: 50 },
    job : Job
});

hasMany Employee, Job, ...

var Task = db.define("task", {
   employee: Employee,
    job : Job,
   client: Client
});

I also imagine that could be implemented somehow using custom types.

kapouer commented 9 years ago

oh yeah, i'm that stupid