Skip to main content
Documents in FrogBot Collections can have relationships to other Documents. When you query a Document, you can specify the depth at which to populate related Documents either as full objects or only their IDs. Since Documents can be infinitely nested or recursively related, it’s important to be able to control how deep your API populates. Depth can impact the performance of your queries by affecting the load on the database and the size of the response. For example, when you specify a depth of 0, the API response might look like this:
But with a depth of 1, the response might look like this:
Depth has no effect in the GraphQL API, because there, depth is based on the shape of your queries.

Local API

To specify depth in the Local API, you can use the depth option in your query:

REST API

To specify depth in the REST API, you can use the depth parameter in your query:

Default Depth

If no depth is specified in the request, FrogBot will use its default depth for all requests. By default, this is set to 1. To change the default depth on the application level, you can use the defaultDepth option in your root FrogBot config:

Max Depth

Relationship and Upload fields can also set a maximum depth. If exceeded, this limits the population depth regardless of the depth requested. To set a max depth for a field, use the maxDepth property in your field configuration: