Closed Leo843 closed 2 years ago
This is likely a duplicate of https://github.com/feathersjs-ecosystem/feathers-sequelize/issues/343
Just stumbled on this. Waiting for a fix, but until then try adding this to your Sequelize model (syntax as of Sequelize v4):
hooks: { beforeCount(options) { options.distinct = false; }, },
Originally posted by @1valdis in https://github.com/feathersjs-ecosystem/feathers-sequelize/issues/343#issuecomment-874798529
Doing this, fixed the issue for me.
Description
When a GET request is made to the REST API, parameter "total" in the response is not the actual number of items in the database table.
This behavior occurs when a service uses Sequelize with PostgreSQL and the model is defined with a composite primary key (more than one primary key).
Steps to reproduce
I made a repo to reproduce the issue. Clone the repository and run
docker compose run test-runner
.Expected behavior
Parameter "total" must always be the actual number of items in the table, even when the model uses a composite primary key.