Skip to content

Count includes records regardless of include #50

@dsmackie

Description

@dsmackie

When a query has an include with a where condition, the result set matches the query but the total record count includes all available records.

let articles = Articles.paginate({
  where: {
    active: true
  },
  include: {
    model: Organisations,
    where: {
      id: 1
    }
  }
});

The above will return the correct records, but count ignores the include where criteria and returns the count of all records.

Line https://github.com/eclass/sequelize-paginate/blob/master/src/index.js#L50 appears to be responsible.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions