Skip to content

Count Metadata doesn't take filtering into account #7631

@sebqq

Description

@sebqq

Hello.

I have this situation, where {entity}/count REST endpoint with deep filtering and using '_or' clause is not working properly. Count value is even bigger than number of items that are stored in my db (of that type) at time of request.

So we have these two tables: Dogs and Colors. Every dog can have multiple colors assigned using following relation:

Screenshot 2020-08-27 at 19 13 11

Please look at following picture to see, what query params are comming from our Frontend to strapi endpoint (endpoint is overriden only for purposes of this test. We normally use pre-generated endpoint):

Screenshot 2020-08-27 at 19 26 00

As you can see, I have 11 dogs in my development DB, but count endpoint has provided 15 as result.

Cause of the issue is the most probably a fact, that some of dogs have multiple colors assigned. When I use only 1 color per dog, thne the filtering problem dissapears.

Does anyone know, what could be the reason for this behaviour?

Thank you so much and have a nice day!

System

  • Strapi version: 3.1.4
  • Database: tried on SQLite and PostgreSQL
  • Operating system: macOS Catalina

Metadata

Metadata

Assignees

Labels

issue: bugIssue reporting a bugseverity: highIf it breaks the basic use of the productsource: core:databaseSource is core/database packagestatus: confirmedConfirmed by a Strapi Team member or multiple community members

Type

No type

Projects

Status

Archived

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions