1602/jugglingdb — Issue #33: belongsTo not working properly on mongoose
Author: nesterko
Created: 2012-02-18 21:33:36+00:00
State: open

Database: Mongoose.
Schema has this relationship:
PersonInfo.belongsTo User, {as: 'user', foreignKey: 'personinfoId'}

and this is a code snippet
...
userdata.save () ->
userdata.user user
user.save () ->
promise.fulfill user
...

personinfoId field in User remains empty, and user() getter function does not work. This is remedied by explicitly assigning

userdata.save () ->
user.personinfoId = userdata.id
user.save () ->
promise.fulfill user

but then it seems that user() helper functionality is broken. Thanks.