How could i get object with One-to-many relations count?

image

Ios sdk question. Is it possible obtain Movie array objects with a count of actors?

I figured out about Object count API (Get Object Count - Backendless SDK for iOS API Documentation),
but if Array of Movies has 100 objects, i have to request 100 times for each element of Array.

I also read about Aggregate Functions API (COUNT - Backendless SDK for iOS API Documentation),
but cant comprehend how it works. Besides Aggregate Functions lost actual objectId for certain object…

Thanks.

You can try do the following in the REST CONSOLE section for Movie table:

  1. add to the request unique column, let it be title
  2. add the dynamic property (the same ways as for real column): count(actors.objectId) as actors_count
  3. add aggregation: group by your unique field group by title

Then you’ll receive what you want.
The same approach can be used for any SDK (when you create BackendlessDataQuery)

It took me a while to figure it out, but it works great! Thanks a lot!