Closed andyrichardson closed 7 years ago
I may be misunderstanding here, (first day using seraph came to look at expanding the features of includes and found this) but isn't this achievable by defining your includes in an object rather than an array?
Using your example:
const opts = {
limit: 1,
include: {
friends: { // <-key declaratioin here
model: model,
rel: 'has_friend',
direction: 'in',
many: true
}
}]
};
model.where(id, opts function(){
...
This is what I've been doing to structure my includes and it has worked.
Thanks for the response, I've gotten past this issue for the time being. When it comes to refactoring, I'll be sure to check out your solution!
When including non-composed models in read queries, it would make sense if the resulting 'compositions'/relationships could be keyed like traditional compositions.
Current result
Desired result
Implementation