Type parameters
- 
						T
Index
Constructors
Properties
Methods
Constructors
Private constructor
- 
							
							Returns CollectionReference
Properties
firestore
The Firestore for the Firestore database (useful for performing
							transactions, etc.).
id
The collection's identifier.
parent
A reference to the containing DocumentReference if this is a subcollection.
							If this isn't a subcollection, the reference is null.
path
A string representing the path of the referenced collection (relative to the root of the database).
Methods
add
- 
							Add a new document to this collection with the specified data, assigning it a document ID automatically. Parameters- 
									data: TAn Object containing the data for the new document. 
 Returns Promise<DocumentReference<T>>A Promise resolved with a DocumentReferencepointing to the newly created document after it has been written to the backend.
- 
									
doc
- 
							Get a DocumentReferencefor the document within the collection at the specified path. If no path is specified, an automatically-generated unique ID will be used for the returned DocumentReference.Parameters- 
									Optional documentPath: stringA slash-separated path to a document. 
 Returns DocumentReference<T>The DocumentReferenceinstance.
- 
									
endAt 
					- 
							
							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. Parameters- 
									snapshot: DocumentSnapshot<any>The snapshot of the document to end at. 
 Returns Query<T>The created Query. 
- 
									
- 
							
							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. Parameters- 
									Rest ...fieldValues: any[]The field values to end this query at, in order of the query's order by. 
 Returns Query<T>The created Query. 
- 
									
endBefore 
					- 
							
							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. Parameters- 
									snapshot: DocumentSnapshot<any>The snapshot of the document to end before. 
 Returns Query<T>The created 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. Parameters- 
									Rest ...fieldValues: any[]The field values to end this query before, in order of the query's order by. 
 Returns Query<T>The created Query. 
- 
									
get
- 
							
							Executes the query and returns the results as a QuerySnapshot.Note: By default, get() attempts to provide up-to-date data when possible by waiting for data from the server, but it may return cached data or fail if you are offline and the server cannot be reached. This behavior can be altered via the GetOptionsparameter.Parameters- 
									Optional options: GetOptionsAn object to configure the get behavior. 
 Returns Promise<QuerySnapshot<T>>A Promise that will be resolved with the results of the Query. 
- 
									
isEqual 
					- 
							
							Returns true if this CollectionReferenceis equal to the provided one.Parameters- 
									other: CollectionReference<T>The CollectionReferenceto compare against.
 Returns booleantrue if this CollectionReferenceis equal to the provided one.
- 
									
limit
- 
							
							Creates and returns a new Query that only returns the first matching documents. Parameters- 
									limit: numberThe maximum number of items to return. 
 Returns Query<T>The created Query. 
- 
									
limitToLast 
					- 
							
							Creates and returns a new Query that only returns the last matching documents. You must specify at least one orderByclause forlimitToLastqueries, otherwise an exception will be thrown during execution.Parameters- 
									limit: numberThe maximum number of items to return. 
 Returns Query<T>The created Query. 
- 
									
onSnapshot 
					- 
							
							Attaches a listener for QuerySnapshot events. You may either pass individual onNextandonErrorcallbacks or pass a single observer object withnextanderrorcallbacks. The listener can be cancelled by calling the function that is returned whenonSnapshotis called.NOTE: Although an onCompletioncallback can be provided, it will never be called because the snapshot stream is never-ending.Parameters- 
									observer: { complete?: () => void; error?: (error: FirestoreError) => void; next?: (snapshot: QuerySnapshot<T>) => void }A single object containing nextanderrorcallbacks.- 
											Optional complete?: () => void- 
													- 
															Returns void
 
- 
															
 
- 
													
- 
											Optional error?: (error: FirestoreError) => void- 
													- 
															Parameters- 
																	error: FirestoreError
 Returns void
- 
																	
 
- 
															
 
- 
													
- 
											Optional next?: (snapshot: QuerySnapshot<T>) => void- 
													- 
															Parameters- 
																	snapshot: QuerySnapshot<T>
 Returns void
- 
																	
 
- 
															
 
- 
													
 
- 
											
 Returns () => voidAn unsubscribe function that can be called to cancel the snapshot listener. - 
									- 
											Returns void
 
- 
											
 
- 
									
- 
							
							Attaches a listener for QuerySnapshot events. You may either pass individual onNextandonErrorcallbacks or pass a single observer object withnextanderrorcallbacks. The listener can be cancelled by calling the function that is returned whenonSnapshotis called.NOTE: Although an onCompletioncallback can be provided, it will never be called because the snapshot stream is never-ending.Parameters- 
									options: SnapshotListenOptionsOptions controlling the listen behavior. 
- 
									observer: { complete?: () => void; error?: (error: FirestoreError) => void; next?: (snapshot: QuerySnapshot<T>) => void }A single object containing nextanderrorcallbacks.- 
											Optional complete?: () => void- 
													- 
															Returns void
 
- 
															
 
- 
													
- 
											Optional error?: (error: FirestoreError) => void- 
													- 
															Parameters- 
																	error: FirestoreError
 Returns void
- 
																	
 
- 
															
 
- 
													
- 
											Optional next?: (snapshot: QuerySnapshot<T>) => void- 
													- 
															Parameters- 
																	snapshot: QuerySnapshot<T>
 Returns void
- 
																	
 
- 
															
 
- 
													
 
- 
											
 Returns () => voidAn unsubscribe function that can be called to cancel the snapshot listener. - 
									- 
											Returns void
 
- 
											
 
- 
									
- 
							
							Attaches a listener for QuerySnapshot events. You may either pass individual onNextandonErrorcallbacks or pass a single observer object withnextanderrorcallbacks. The listener can be cancelled by calling the function that is returned whenonSnapshotis called.NOTE: Although an onCompletioncallback can be provided, it will never be called because the snapshot stream is never-ending.Parameters- 
									onNext: (snapshot: QuerySnapshot<T>) => voidA callback to be called every time a new QuerySnapshotis available.- 
											- 
													Parameters- 
															snapshot: QuerySnapshot<T>
 Returns void
- 
															
 
- 
													
 
- 
											
- 
									Optional onError: (error: FirestoreError) => voidA callback to be called if the listen fails or is cancelled. No further callbacks will occur. - 
											- 
													Parameters- 
															error: FirestoreError
 Returns void
- 
															
 
- 
													
 
- 
											
- 
									Optional onCompletion: () => void- 
											- 
													Returns void
 
- 
													
 
- 
											
 Returns () => voidAn unsubscribe function that can be called to cancel the snapshot listener. - 
									- 
											Returns void
 
- 
											
 
- 
									
- 
							
							Attaches a listener for QuerySnapshot events. You may either pass individual onNextandonErrorcallbacks or pass a single observer object withnextanderrorcallbacks. The listener can be cancelled by calling the function that is returned whenonSnapshotis called.NOTE: Although an onCompletioncallback can be provided, it will never be called because the snapshot stream is never-ending.Parameters- 
									options: SnapshotListenOptionsOptions controlling the listen behavior. 
- 
									onNext: (snapshot: QuerySnapshot<T>) => voidA callback to be called every time a new QuerySnapshotis available.- 
											- 
													Parameters- 
															snapshot: QuerySnapshot<T>
 Returns void
- 
															
 
- 
													
 
- 
											
- 
									Optional onError: (error: FirestoreError) => voidA callback to be called if the listen fails or is cancelled. No further callbacks will occur. - 
											- 
													Parameters- 
															error: FirestoreError
 Returns void
- 
															
 
- 
													
 
- 
											
- 
									Optional onCompletion: () => void- 
											- 
													Returns void
 
- 
													
 
- 
											
 Returns () => voidAn unsubscribe function that can be called to cancel the snapshot listener. - 
									- 
											Returns void
 
- 
											
 
- 
									
orderBy 
					- 
							
							Creates and returns a new Query that's additionally sorted by the specified field, optionally in descending order instead of ascending. Parameters- 
									fieldPath: string | FieldPathThe field to sort by. 
- 
									Optional directionStr: OrderByDirectionOptional direction to sort by ( ascordesc). If not specified, order will be ascending.
 Returns Query<T>The created Query. 
- 
									
startAfter 
					- 
							
							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. Parameters- 
									snapshot: DocumentSnapshot<any>The snapshot of the document to start after. 
 Returns Query<T>The created 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. Parameters- 
									Rest ...fieldValues: any[]The field values to start this query after, in order of the query's order by. 
 Returns Query<T>The created Query. 
- 
									
startAt 
					- 
							
							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 orderByof this query.Parameters- 
									snapshot: DocumentSnapshot<any>The snapshot of the document to start at. 
 Returns Query<T>The created 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. Parameters- 
									Rest ...fieldValues: any[]The field values to start this query at, in order of the query's order by. 
 Returns Query<T>The created Query. 
- 
									
where
- 
							
							Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should satisfy the relation constraint provided. Parameters- 
									fieldPath: string | FieldPathThe path to compare 
- 
									opStr: WhereFilterOpThe operation string (e.g "<", "<=", "==", ">", ">="). 
- 
									value: anyThe value for comparison 
 Returns Query<T>The created Query. 
- 
									
withConverter 
					- 
							
							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 and your custom type U. Passing in nullas the converter parameter removes the current converter.Parameters- 
									converter: nullConverts objects to and from Firestore. Passing in nullremoves the current converter.
 Returns CollectionReference<DocumentData>A CollectionReference that uses the provided converter. 
- 
									
- 
							
							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 and your custom type U. Passing in nullas the converter parameter removes the current converter.Type parameters- 
									U
 Parameters- 
									converter: FirestoreDataConverter<U>Converts objects to and from Firestore. Passing in nullremoves the current converter.
 Returns CollectionReference<U>A CollectionReference that uses the provided converter. 
- 
									
A
CollectionReferenceobject can be used for adding documents, getting document references, and querying for documents (using the methods inherited fromQuery).