java.lang.Object | ||
↳ | com.google.firebase.firestore.Query | |
↳ | com.google.firebase.firestore.CollectionReference |
A CollectionReference can be used for adding documents, getting document references, and querying for documents (using the methods inherited from Query).
Subclassing Note: Firestore classes are not meant to be subclassed except for use in test mocks. Subclassing is not supported in production code and new SDK releases may break code that does so.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adds a new document to this collection with the specified data, assigning it a document ID
automatically.
| |||||||||||
Adds a new document to this collection with the specified POJO as contents, assigning it a
document ID automatically.
| |||||||||||
Returns a DocumentReference pointing to a new document with an auto-generated ID within this
collection.
| |||||||||||
Gets a DocumentReference instance that refers to the document at the specified path within this
collection.
| |||||||||||
Gets a DocumentReference to the document that contains this collection.
| |||||||||||
Gets the path of this collection (relative to the root of the database) as a slash-separated
string.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Adds a new document to this collection with the specified data, assigning it a document ID automatically.
Parameters | |
---|---|
data |
Map : A Map containing the data for the new document. |
Returns | |
---|---|
Task<DocumentReference> |
A Task that will be resolved with the DocumentReference of the newly created document. |
Adds a new document to this collection with the specified POJO as contents, assigning it a document ID automatically.
Parameters | |
---|---|
pojo |
Object : The POJO that will be used to populate the contents of the document |
Returns | |
---|---|
Task<DocumentReference> |
A Task that will be resolved with the DocumentReference of the newly created document. |
Returns a DocumentReference pointing to a new document with an auto-generated ID within this collection.
Returns | |
---|---|
DocumentReference |
A DocumentReference pointing to a new document with an auto-generated ID. |
Gets a DocumentReference instance that refers to the document at the specified path within this collection.
Parameters | |
---|---|
documentPath |
String : A slash-separated relative path to a document. |
Returns | |
---|---|
DocumentReference |
The DocumentReference instance. |
Returns | |
---|---|
String |
The ID of the collection. |
Gets a DocumentReference to the document that contains this collection. Only subcollections are contained in a document. For root collections, returns null.
Returns | |
---|---|
DocumentReference |
The DocumentReference that contains this collection or null if this is a root collection. |
Gets the path of this collection (relative to the root of the database) as a slash-separated string.
Returns | |
---|---|
String |
The path of this collection. |