You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am seeing a strange behavior in feathers-objection. If context.params.query has operator "$joinRelation" but no operator "groupBy", feathers-objection will add (*) in "select" which makes operator $select irrelevant. Is there a reason for this implementation or is this a bug? The version of the feathers-objection I use is 7.5.1.
For example:
I have a model "users" that has a ManyToManyRelation roles with model "Roles"
In a find query, context.params.query: { "$select": ["email"] }
This will only show the "email" and "id" fields in the model and it works correctly.
If adding $joinRelation, context.params.query: { "$select": ["email"], "$joinRelation": {"roles": true } }
This will show ALL the fields in the model despite the $select: ["email"].
The SQL query generated has "select users.email, users.id, users.* from...".
I looked into feathers-objection code and found the users.* is added in groupByColumns check:
One workaround to show only the fields in $select when using joinRelation is adding a modifier builder.groupBy('users.id'); into the query. This works but feels awkward. Are there any cleaner ways to get around this issue?
The text was updated successfully, but these errors were encountered:
I have similar problem with this. When using $sort with $joinRelation DB throw error not having ORDER BY column in SELECT. Can you at least add a way how to opt out of adding this distinct?
I am seeing a strange behavior in feathers-objection. If context.params.query has operator "$joinRelation" but no operator "groupBy", feathers-objection will add (*) in "select" which makes operator $select irrelevant. Is there a reason for this implementation or is this a bug? The version of the feathers-objection I use is 7.5.1.
For example:
I have a model "users" that has a ManyToManyRelation roles with model "Roles"
In a find query,
context.params.query: { "$select": ["email"] }
This will only show the "email" and "id" fields in the model and it works correctly.
If adding $joinRelation,
context.params.query: { "$select": ["email"], "$joinRelation": {"roles": true } }
This will show ALL the fields in the model despite the $select: ["email"].
The SQL query generated has "select users.email, users.id, users.* from...".
I looked into feathers-objection code and found the users.* is added in groupByColumns check:
One workaround to show only the fields in $select when using joinRelation is adding a modifier
builder.groupBy('users.id');
into the query. This works but feels awkward. Are there any cleaner ways to get around this issue?The text was updated successfully, but these errors were encountered: