CollectionReference<T extends dynamic> class
A CollectionReference can be used for adding documents, getting document references, and querying for documents (using the methods inherited from Query).
Properties
-
converter
→ FirestoreDataConverter<
T> ? -
The converter applied to the documents this query returns, if any.
finalinherited
- firestore → FirebaseFirestore
-
The Firestore instance of this query.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
The ID of the collection.
no setter
-
parent
→ DocumentReference<
Map< ?String, Object?> > -
The document that contains this collection, or null for a collection at
the root of the database.
no setter
- path → String
-
The path of the collection, relative to the root of the database.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
T data) → Future< DocumentReference< T> > -
Adds a new document with
datato this collection, with an auto-generated ID, and returns its reference once the backend has written it. -
aggregate(
List< AggregateField> aggregateFields) → AggregateQuery -
Returns an AggregateQuery that calculates the given aggregations over
the result set of this query without downloading the documents.
inherited
-
aggregateWithAliases(
Map< String, AggregateField> aggregates) → AggregateQuery -
Returns an AggregateQuery that calculates the given aggregations over
the result set of this query, with results keyed by user-chosen aliases:
inherited
-
count(
) → AggregateQuery -
Returns an AggregateQuery that counts the documents in the result set
of this query without downloading them.
inherited
-
doc(
[String? documentPath]) → DocumentReference< T> -
Returns a DocumentReference to the document at
documentPathwithin this collection, or to a new document with an auto-generated ID when no path is given. -
endAt(
Iterable< Object?> fieldValues) → Query<T> -
Creates and returns a new Query that ends at the provided fields relative to the order of the query. The order
of the field values must match the order of the order by clauses of the query.
inherited
-
endAtDocument(
DocumentSnapshot< Object?> snapshot) → Query<T> -
Creates and returns a new Query that ends at the provided document (inclusive). The end position is relative to
the order of the query. The document must contain all of the fields provided in the orderBy of this query.
inherited
-
endBefore(
Iterable< Object?> fieldValues) → Query<T> -
Creates and returns a new Query that ends before the provided fields relative to the order of the query. The
order of the field values must match the order of the order by clauses of the query.
inherited
-
endBeforeDocument(
DocumentSnapshot< Object?> snapshot) → Query<T> -
Creates and returns a new Query that ends before the provided document (exclusive). The end position is relative
to the order of the query. The document must contain all of the fields provided in the orderBy of this query.
inherited
-
get(
) → Future< QuerySnapshot< T> > -
Runs the query on the backend and returns the matching documents.
inherited
-
limit(
int limit) → Query< T> -
Creates and returns a new Query that's additionally limited to only return up to the specified number of
documents. This overrides a previous limitToLast.
inherited
-
limitToLast(
int limit) → Query< T> -
Creates and returns a new Query that only returns the last matching documents up to the specified number. This
overrides a previous
limit.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
orderBy(
Object field, {bool descending = false}) → Query< T> -
Creates and returns a new Query that's additionally sorted by
field, a String (dots separate nested fields) or a FieldPath, in ascending order or, withdescending, in descending order.inherited -
startAfter(
Iterable< Object?> fieldValues) → Query<T> -
Creates and returns a new Query that starts after the provided fields relative to the order of the query. The
order of the field values must match the order of the order by clauses of the query.
inherited
-
startAfterDocument(
DocumentSnapshot< Object?> snapshot) → Query<T> -
Creates and returns a new Query that starts after the provided document (exclusive). The starting position is
relative to the order of the query. The document must contain all of the fields provided in the orderBy of this
query.
inherited
-
startAt(
Iterable< Object?> fieldValues) → Query<T> -
Creates and returns a new Query that starts at the provided fields relative to the order of the query. The order
of the field values must match the order of the order by clauses of the query.
inherited
-
startAtDocument(
DocumentSnapshot< Object?> snapshot) → Query<T> -
Creates and returns a new Query that starts at the provided document (inclusive). The starting position is
relative to the order of the query. The document must contain all of the fields provided in the orderBy of this
query.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
where(
Object fieldOrFilter, {Object? isEqualTo, Object? isNotEqualTo, Object? isLessThan, Object? isLessThanOrEqualTo, Object? isGreaterThan, Object? isGreaterThanOrEqualTo, Object? arrayContains, Iterable< Object?> ? arrayContainsAny, Iterable<Object?> ? whereIn, Iterable<Object?> ? whereNotIn, bool? isNull}) → Query<T> -
Creates and returns a new Query with additional filters.
inherited
-
withConverter<
U extends Object?> ({required FromFirestore< U> fromFirestore, required ToFirestore<U> toFirestore}) → CollectionReference<U> -
Returns the same query, returning objects of type
Umade byfromFirestore(and written withtoFirestore).override -
withoutConverter(
) → CollectionReference< Map< String, Object?> > -
Returns the same query without a converter.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited