directus / directus/directus

Sub-level count function not working when filter applied

Open
#14,780 2 comments 0 reactions 0 assignees View on GitHub
Bug Engine Querying
Dominant language
TypeScript
Stars
37.9k
Forks
4.9k
Avg merge
3d 21h
Merged PRs (30d)
36

Description

### Describe the Bug

I'm trying to combine a filter with the count function on a sub-level collection, filter works as expected but the count function returns all the items before the filter is applied.

### To Reproduce

Here's the example, the count for the project_updates collection should show 1 (i'm requesting the updates related to a single project, in this case and for example purposes only 1 update has been made) as it is in the GET response, but instead is showing 11, which are all the items related to the parent collection.

![image](https://user-images.githubusercontent.com/5248081/182192421-40389417-f18b-4a68-b8f2-a82f17f19da8.png)

### Errors Shown

No.

### What version of Directus are you using?

9.14.5

### What version of Node.js are you using?

14.16.0

### What database are you using?

MySQL / MariaDB / Percona 10.3.34

### What browser are you using?

chrome

### How are you deploying Directus?

Self Hosted, Ubuntu + plesk

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.