dresende / node-orm2

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

setOwner is not a function #775

Closed Natanael1234 closed 7 years ago

Natanael1234 commented 7 years ago

When I try to associate two models after set the hasOne relation

let District = this.models['district']; let City = this.models['city']; District.hasOne('city', City, { reverse: true });

I get this error:

TypeError: district.setOwner is not a function
    at E:\Node\http-request\testadb.js:44:72
    at E:\Node\http-request\node_modules\orm\lib\Model.js:616:4
    at E:\Node\http-request\node_modules\async\dist\async.js:356:16
    at replenish (E:\Node\http-request\node_modules\async\dist\async.js:877:25)
    at iterateeCallback (E:\Node\http-request\node_modules\async\dist\async.js:867:17)
    at E:\Node\http-request\node_modules\async\dist\async.js:840:16
    at E:\Node\http-request\node_modules\orm\lib\Model.js:609:6
    at E:\Node\http-request\node_modules\orm\lib\Instance.js:619:12
    at saveInstanceExtra (E:\Node\http-request\node_modules\orm\lib\Instance.js:341:19)
    at E:\Node\http-request\node_modules\orm\lib\Instance.js:190:5
dxg commented 7 years ago

Not sure what Owner is, looking at the above.