CollectionReference extension type

A CollectionReference object can be used for adding documents, getting document references, and querying for documents (using the methods inherited from Query).

on
Implemented types
Available extensions

Properties

firestore Firestore
The Firestore for the Firestore database (useful for performing transactions, etc.).
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
it String
The identifier of the collection.
no setter
parent DocumentReference?
A reference to the containing Document if this is a subcollection, else null.
no setter
path String
A string representing the path of the referenced 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(JSObject data) JSPromise<DocumentReference>
Add a new document to this collection with the specified data, assigning it a document ID automatically.
aggregate(JSObject aggregateSpec) AggregateQuery
Returns a query that can perform the given aggregations.
inherited
count() AggregateQuery
Returns a query that counts the documents in the result set of this query.
inherited
doc([String documentPath]) DocumentReference
Get a DocumentReference for the document within the collection at the specified path.
endAt(DocumentSnapshot snapshot) Query
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
endBefore(DocumentSnapshot snapshot) Query
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
explain(ExplainOptions options) JSPromise<ExplainResults<QuerySnapshot>>
Plans and optionally executes this query. Returns a Promise that will be resolved with the planner information, statistics from the query execution (if any), and the query results (if any).
inherited
findNearest(JSAny vectorField, JSObject queryVector, JSObject options) VectorQuery
Returns a query that can perform vector distance (similarity) search with given parameters.
inherited
get() JSPromise<QuerySnapshot>
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
isEqual(CollectionReference other) bool
Returns true if this CollectionReference is equal to the provided one.
override
limit(int limit) Query
Creates and returns a new Query that only returns the first matching documents.
inherited
limitToLast(int limit) Query
Creates and returns a new Query that only returns the last matching documents.
inherited
listDocuments() JSPromise<JSArray<DocumentReference>>
Retrieves the list of documents in this collection.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
offset(int offset) Query
Specifies the offset of the returned results.
inherited
onSnapshot(JSFunction onNext, [JSFunction onError]) → void
Executes the query and returns the results as Node Stream.
inherited
orderBy(JSAny fieldPath, [String directionStr]) Query
Creates and returns a new Query that's additionally sorted by the specified field, optionally in descending order instead of ascending.
inherited
startAfter(DocumentSnapshot snapshot) Query
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
startAt(DocumentSnapshot snapshot) Query
Creates and returns a new Query instance that applies a field mask to the result and returns only the specified subset of fields. You can specify a list of field paths to return, or use an empty list to only return the references of matching documents.
inherited
toString() String
A string representation of this object.
inherited
where(Filter filter) Query
Creates and returns a new Query{@link Query} with the additional filter that documents should satisfy the relation constraint provided. Documents must contain the field specified in the filter.
inherited
whereFieldPath(JSAny fieldPath, String opStr, JSAny value) Query
Creates and returns a new Query with the additional filter that documents must contain the specified field and that its value should satisfy the relation constraint provided.
inherited
withConverter(FirestoreDataConverter? converter) CollectionReference
Applies a custom data converter to this CollectionReference, allowing you to use your own custom model objects with Firestore. When you call add() on the returned CollectionReference instance, the provided converter will convert between Firestore data of type NewDbModelType and your custom type NewAppModelType.
override

Operators

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