CollectionReference<T> class final

A reference to a collection of documents in the Winche Database.

A CollectionReference is also a QueryReference over the whole collection, so query builders (where, orderBy, limit, cursors) and terminal operations (get, snapshots, count) are available directly:

db.collection('users').where('age', isGreaterThan: 18).orderBy('age').get();
Inheritance

Properties

hashCode int
The hash code for this object.
no setterinherited
id String
The collection ID (the last path segment).
no setter
path String
The full collection path, e.g. users or users/u1/posts.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
spec QuerySpec
The underlying QuerySpec (for testing and listener use).
no setterinherited

Methods

add(T data) Future<DocumentReference<T>>
Adds a new document with data and a generated ID.
count() Future<int>
Returns the number of documents matching this query.
inherited
doc([String? id]) DocumentReference<T>
Returns a reference to the document with the given id (carries this collection's converter).
endAt(List<Object?> values) QueryReference<T>
Ends the query at values (inclusive).
inherited
endBefore(List<Object?> values) QueryReference<T>
Ends the query before values (exclusive).
inherited
get([GetOptions options = const GetOptions()]) Future<QuerySnapshot<T>>
Executes the query and returns a one-shot QuerySnapshot (from cache when offline).
inherited
limit(int n) QueryReference<T>
Sets the maximum number of documents returned.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
orderBy(String field, {bool descending = false}) QueryReference<T>
Adds an orderBy clause.
inherited
select(List<String> fields) QueryReference<T>
Restricts returned documents to fields (dotted paths). Document id, path, and metadata are always included.
inherited
snapshots() Stream<QuerySnapshot<T>>
Returns a live Stream of QuerySnapshots (PROTOCOL §7.6). When offline support is configured, emits cache-first and reacts to local writes; otherwise delegates directly to the server-only machine.
inherited
startAfter(List<Object?> values) QueryReference<T>
Starts the query after values (exclusive).
inherited
startAt(List<Object?> values) QueryReference<T>
Starts the query at values (inclusive).
inherited
toString() String
A string representation of this object.
override
where(String field, {Object? isEqualTo, Object? isNotEqualTo, Object? isLessThan, Object? isLessThanOrEqualTo, Object? isGreaterThan, Object? isGreaterThanOrEqualTo, Object? arrayContains, List<Object?>? arrayContainsAny, List<Object?>? arrayContainsAll, List<Object?>? whereIn, List<Object?>? whereNotIn, Object? contains, Object? startsWith, Object? endsWith, Object? matchesRegex, bool? isNull, bool? isNan, bool? exists}) QueryReference<T>
Adds a field filter. Multiple calls AND-compose. Multiple named args in a single call also AND-compose (I4).
inherited
whereFilter(FilterSpec filter) QueryReference<T>
Adds a raw FilterSpec filter (escape hatch). AND-composed with existing.
inherited
withConverter<R>(Converter<R> converter) CollectionReference<R>
Returns a typed collection that converts document data to and from R.
override

Operators

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