The Query Builder provides a fluent API for building complex queries with filtering, sorting, pagination, and field selection.
Overview
Instead of passing query parameters as an object, use the Query Builder for a more readable and maintainable way to construct queries:
Getting Started
Create a Query Builder
Start a query by calling query() on the records service:
Execute the Query
Execute the query with get():
Chaining Methods
The Query Builder uses method chaining for a fluent API:
Each method returns the Query Builder instance, allowing you to chain multiple methods together.
Complete Example
First() Method
Get the first matching record:
first() automatically sets limit(1) and skip(0) and returns a single
record or null.
Reusable Queries
Create reusable query functions:
Query Builder Methods
Next Steps