Skip to content

[deepkit/orm] query.count() throws an error if used with query pagination #668

@pxDot

Description

@pxDot

Constructing a query like this

let dbQuery = this.itemsPerPage(itemsPerPage).page(page);
const [items, total] = await Promise.all([dbQuery.find(), dbQuery.count()]);

throws

[ERROR] Controller error TypeError: Cannot read properties of undefined (reading 'count')

for page > 1. Its fine for the first page but as soon as the page is incremented it is throwing.

My current workaround looks like this now:

const [items, total] = await Promise.all([dbQuery.itemsPerPage(itemsPerPage).page(page).find(), dbQuery.count()]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions