Cindel’s code generator reads your model annotations and emits fully-typed query helpers for every indexed and persisted field in your collection. You never write raw SQL or manually encode field names — instead you chain type-safe method calls that the generator verifies against your actual schema. This page describes both the index-backedDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/mainser/cindel/llms.txt
Use this file to discover all available pages before exploring further.
where() path and the general filter() path, along with sorting, pagination, projections, aggregates, and the composition helpers used for dynamic query construction.
where() requires the target field to have an @Index annotation. filter() works on any persisted field — indexed or not. For best performance on large collections, reach for where() first and layer filter() predicates only when you need conditions that go beyond what an index can provide.
Both
where() and filter() chains terminate with a result method: findFirst(), findAll(), count(), deleteAll(), or updateAll().Index-Backed Lookups with where()
Generated where() helpers compile down to native index queries that bypass full-collection scans. The available methods depend on the field type and index configuration:
where() chain terminates with a result method such as findFirst() or findAll(). The generated helpers are named after the field — emailEqualTo, createdAtBetween, nameStartsWith, and so on.
General Filtering with filter()
filter() applies predicates to every persisted field including non-indexed ones. It also supports sorting and pagination:
String Predicates
String fields supportcontains, prefix (StartsWith), and suffix (EndsWith) predicates:
List Field Helpers
ForList<T> fields, Cindel generates element membership and length predicates:
Embedded Object Filters
For fields typed as@embedded classes, the generator produces a nested callback builder that lets you filter on embedded fields at any depth:
Composition Helpers
Three composition utilities let you build queries dynamically withoutif statements scattered across your code:
optional — conditional filter
Applies the builder only when condition is true, otherwise returns the query unchanged:
anyOf — OR across a list of values
Applies the builder once for each item and ORs the resulting filters together. An empty list matches nothing:
allOf — AND across a list of values
Applies the builder once for each item and ANDs the resulting filters together. An empty list returns the query unchanged:
Terminal Operations
Every query chain ends with one of these:| Method | Return type | Description |
|---|---|---|
findAll() | Future<List<T>> | Returns all matching objects. |
findFirst() | Future<T?> | Returns the first matching object, or null. |
count() | Future<int> | Returns the count of matching documents without hydrating objects. |
deleteAll() | Future<int> | Deletes every matching document and returns the count. |
updateAll(changes) | Future<int> | Applies field updates to every matching document and returns the count. |
Querying Every Document — all()
all() starts a query over the entire collection with no index source. Combine it with filter(), sort, and projection:
Sorting
GeneratedsortBy* methods sort by a named field in ascending order; sortBy*Desc sorts descending. Chain multiple sort calls to apply secondary sort keys:
Pagination
.offset(n) skips n results after all filters, sorting, and distinct are applied. .limit(n) caps the result count. Chain them together for page-based navigation:
Projections
Chain a generated*Property() method to return only a single field value instead of full objects. This avoids deserializing fields you don’t need:
Aggregates
Property queries expose aggregate terminal operations:Mutation via Query
deleteAll
Delete every document matching the current filter, returning the number of deleted documents:
updateAll
Apply a map of field updates to every matching document atomically, returning the count of updated documents:
@Name overrides). Values must be null, bool, int, double, String, List, or Map.