We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Objection.js version: 3.1.5 Node.js version: 20.11 Db engine: postgres
I have a User Model with a relation on events:
class User extends Model { static get relationMappings() { return { events: { relation: Model.HasManyRelation, modelClass: "Event", join: { from: "users.id", to: "events.userId", }, modify(qb) { qb.orderBy("id", "desc"); }, }, }; } }
when i try to get the total count of events for a user:
const query = user.$relatedQuery("events") query.has("orderBy") // false const totalCount = await query.resultSize()
Despite the this.clone().clear(/orderBy|offset|limit/);, the ORDER BY clause remains, resulting in a less performant query:
this.clone().clear(/orderBy|offset|limit/);
ORDER BY
SELECT count(*) AS "count" FROM ( SELECT "events".* FROM "events" WHERE "events"."user_id" IN (?) ORDER BY "id" DESC ) AS "temp";
Operations applied in modifiers do not seem to be recorded on the queryBuilder object. Is it intentional?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Objection.js version: 3.1.5
Node.js version: 20.11
Db engine: postgres
I have a User Model with a relation on events:
when i try to get the total count of events for a user:
Despite the
this.clone().clear(/orderBy|offset|limit/);
, theORDER BY
clause remains, resulting in a less performant query:Operations applied in modifiers do not seem to be recorded on the queryBuilder object. Is it intentional?
The text was updated successfully, but these errors were encountered: