I have two models, User and Capture, where a Capture can be related to multiple users: it is owned, claimed, and processed all by three different users.
User = thinky.createModel 'User',
id: String
displayName: String
email: String
Capture = thinky.createModel 'Capture',
id: String
ownerID: String
processedByID: String
claimedByID: String
created: Date
updated: Date
Capture.belongsTo User.model, 'owner', 'ownerID', 'id'
Capture.belongsTo User.model, 'processedBy', 'processedByID', 'id'
Capture.belongsTo User.model, 'claimedBy', 'claimedByID', 'id'
The owner relationship works, but I cannot get the processedBy and claimedBy relationships to work. I'm querying with .getJoin()
, and Thinky has created the secondary indexes on my tables (so it at least knows about the relationships)
What am I doing wrong? How can I get the nested objects to return in my queries?
That's because thinky will join another model once by default (to avoid circular references). You must be explicit on the links you want to fetch: