Single-Property Projections
Generated property helpers project one persisted field from a query result. Call the helper after your query conditions and execute withfindAll() or findFirst().
findFirst() when only the first projected value is needed:
Dynamic Property Projection
When the field name is only known at runtime, use the lower-levelproperty<T> API:
property<T>('fieldName') only for dynamic code that already works with persisted field names.
Multi-Property Projections
Useproperties([...]) to project several persisted fields at once. The result is a List<CindelDocument>, where each entry is a Map<String, Object?> keyed by the persisted field names you requested.
Pass persisted field names to
properties([...]). If a model field is annotated with @Name, its persisted name may differ from the Dart field name. Generated single-property helpers handle this automatically when the field is known at compile time.Aggregates
Aggregate helpers are available on any property query. Chain them in place offindAll() or findFirst() to receive a single computed value.
count()
count() counts non-null projected values. Use query-level count() (without a property) when you want to count the matching objects themselves:
min() and max()
min() and max() require comparable values (dates, numbers, strings):
sum() and average()
sum() and average() require numeric values:
Combining Aggregates with Filters
All aggregates compose naturally with filters. Apply conditions before the property projection:Common Use Cases
Choosing the Right Query Shape
Use this decision guide to pick the right approach for each screen or operation:CindelDocument (Map<String, Object?>) is the map-shaped type returned by multi-property projections. Most application code should prefer typed objects and generated helpers unless you are intentionally working with a partial projection.