Segments
Last updated
Was this helpful?
Last updated
Was this helpful?
This is the official documentation of the @forestadmin/agent
Node.js agent.
A Segment is a subset of a Collection: it's a saved filter of your Collection.
Segments are designed for those who want to systematically visualize data according to specific sets of filters. It allows you to save filter configurations so user don’t have to do repetitive actions every day.
Segments can be configured from the interface, without the need to write any code.
Sometimes, Segment filters are complicated and closely tied to your business. Forest Admin allows you to code how the Segment is computed.
This is documented in the .
For instance, in our , we’ve implemented a Segment on the collection products
to allow admin users to see the bestsellers at a glance.
In the following example, we are making queries using the .
The only requirement when implementing a Segment from your agent is to return a valid ConditionTree
(see ).