RealtimeQueryBuilder<T> class

Builder for realtime collection queries.

Use this builder to compose filters, sorting, and limits before fetching or subscribing to results.

Constructors

RealtimeQueryBuilder({required MongoRealtime client, required String collection, FromJson<T>? fromJson, JsonMap? filter, Map<String, int>? sort, int? limit})

Properties

definition RealtimeQueryDefinition
The compiled query definition used for fetch and subscription operations.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<List<RealtimeDocument<T>>>
A realtime stream of documents matching the current query.
no setter
streamWithValue Stream<List<T>>
A realtime stream of typed values matching the current query.
no setter

Methods

delete({bool optimistic = false}) Future<void>
Deletes documents from the collection matching the query.
find() Future<List<RealtimeDocument<T>>>
Fetches the current matching documents for this query once.
limit(int limit) RealtimeQueryBuilder<T>
Alias for take, used to set the maximum number of documents.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
or(void build(RealtimeQueryOrGroupBuilder group)) RealtimeQueryBuilder<T>
Adds an $or block to the query with the specified group of clauses. Each clause in the group is defined using the same operators as the where method. For example:
orderBy(Map<String, int> sort) RealtimeQueryBuilder<T>
Applies a sort order to the query using a field map.
sort(String field, {bool descending = false}) RealtimeQueryBuilder<T>
take(int limit) RealtimeQueryBuilder<T>
Limits the number of documents returned by the query.
toString() String
A string representation of this object.
inherited
update({JsonMap? $set, JsonMap? $unset, JsonMap? $inc, JsonMap? $push, JsonMap? $pull, JsonMap? $addToSet, JsonMap? $rename, JsonMap? additionalUpdate, bool optimistic = false}) Future<void>
Performs an update on all documents matching the query filter using MongoDB update operators. The update will be applied atomically on the server. If optimistic is true, the cache will be updated immediately with the expected changes, and then reconciled with the server response when it arrives. If optimistic is false, the cache will only be updated when the server confirms the update. The update parameter should be a map containing MongoDB update operators like $set, $unset, $inc, $push, $pull, $addToSet, and $rename. For example:
where(String field, {Object? isEqualTo, Object? isNotEqualTo, Object? isGreaterThan, Object? isGreaterOrEqualTo, Object? isLowerThan, Object? isLowerOrEqualTo, Object? arrayContains, Iterable? isIn, Object? matches}) RealtimeQueryBuilder<T>
Adds a where clause to the query with the specified field and condition. The condition can be one of the following operators:

Operators

operator ==(Object other) bool
The equality operator.
inherited