-
Notifications
You must be signed in to change notification settings - Fork 642
Closed
Description
Model.query().select('pets.*')
returns correctly:
[{
id_pet: 1,
name: 'One'
},
{
id_pet: 2,
name: 'Two'
}]
When using eager like:
related: {
relation: Model.HasOneRelation,
join: {
from: 'pets.id_pet',
to: 'something.id_pet'
}
}
Model.query().select('pets.*').eager('related')
This returns wrong, with missing field:
[{
name: 'One',
related: [{
id_pet: 1,
related_data: 'abc'
}]
},
{
name: 'Two',
related: [{
id_pet: 2,
related_data: 'xyz'
}]
}]
In this example, field id_pet is present in both main table and relation table, and when using eagers it disappears from main table's result.
Note: this is an example, you can try with BelongsToOneRelation or ManyToManyRelation, issue is the same.
Note 2: Just updated objection from 0.6.2 to 0.7.10
Metadata
Metadata
Assignees
Labels
No labels