directus / directus

The flexible backend for all your projects 🐰 Turn your DB into a headless CMS, admin panels, or apps with a custom UI, instant APIs, auth & more.
https://directus.io
Other
28.05k stars 3.91k forks source link

bug: `count(field)` returns string instead of number #20615

Closed sandros94 closed 6 months ago

sandros94 commented 11 months ago

Describe the Bug

Via REST API the count(field) returns a string.

In the following screenshot I was requesting for:

Screenshot 2023-11-29 162835

To Reproduce

use count(field) via postman/hoppscotch/httpie

Directus Version

v10.6.2 & v10.8.2

Hosting Strategy

Self-Hosted (Docker Image)

rijkvanzanten commented 11 months ago

I'm 85% sure that's on purpose as it's a bigInt

br41nslug commented 6 months ago

Aggregation functions like count() indeed return bigInt types hence the string response. https://www.postgresql.org/docs/15/functions-aggregate.html