1602 / jugglingdb

Multi-database ORM for nodejs: redis, mongodb, mysql, sqlite3, postgresql, arango, in-memory...
http://1602.github.io/jugglingdb/
2.04k stars 241 forks source link

Include gives back cached relations #341

Closed wbw20 closed 10 years ago

wbw20 commented 10 years ago

I have some code that looks like:

Post.all({ include: ['user'] }, function(error, data) {(
)};

but when I inspect my data, the posts have their users in a hidden field called __cachedRelations. Is there a clean way of getting a javascript object with the relation as a simple attribute? Thanks.

1602 commented 10 years ago

You can access relations as usual:

Post.all({ include: ['user'] }, function(error, data) {(
    data[0].user(function(err, user) {
    });
)};