Support Topics Documentation Slack YouTube Blog

Set page size for fetching relations with .find(query)

I want to fetch a set of records from a master table together with the associated data captured as relational columns. I’m using:

query.setRelationsDepth( 1 );

It’s really great to get a deep response object containing relations data as arrays.
The docs are mentioning:
" Loading relations with relation depth retrieves only a partial set of the related objects (default size of the retrieved related collection is 10). To load additional related objects, use the Relation Paging API."

My question is: How can I affect the paging size for related data when using .find(query)?

The Relation Paging API is an API which gets the MASTERTABLE.objectId as input. I cannot do this as in my case the set of objectIds is determined by a query.


Hello, @Klaas_Klever.

You can use the following to specify the pageSize for relations:

var queryBuilder = Backendless.DataQueryBuilder.create ();
queryBuilder.setRelationsDepth (1);
queryBuilder.setRelationsPageSize (1); // will only return 1 child

Best regards, Nikita.

Related questions. Can I restrict the set of fields read from the related tables?
Something like addProperties, but now for the related tables …


Hello @Klaas_Klever

Using setRelationsDepth to load data from related tables you cant filter/exclude fields from related tables