Multiple Count Related Objects

We want to count related objects in a given Property. We are using Count function. However, count function seems to be working good when its the only item, but as soon as we add new Count function then it seems the largest count is being followed as the new value.

See issue below:

It seems Count function to be working good when it is the only one on the property:

See image:

However, when there is 2 or more Count function. It seems it add ups counter data.

See image:

Here is the APP ID: 5FA84990-4C00-8598-FFA4-D59E9A294900

Thanks,
Jaypee

Hi @jaypee_peros

At the current moment it is an expected behavior.
When you specify relations or related props in query params under the hood Backendless create SQL query with joins to referenced tables. As a result all aggregation functions (count and others) are applied to Cartesian product which was produced by that SQL query.
Currently we are investigating possible improvements which will allow to eliminate this behavior. By now I would recommed you use only one count per query. Sorry for inconvenience.

Regards, Andriy

Hello Andriy,

Oh i see. That is noted.

We hope that multiple count feature will work on one query so that we can minimized number of queries on our custom APIs.

Thanks,
Jaypee