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()]);