java.lang.Object | |
↳ | com.google.firebase.firestore.DocumentReference |
A DocumentReference refers to a document location in a Firestore database and can be used to write, read, or listen to the location. There may or may not exist a document at the referenced location. A DocumentReference can also be used to create a CollectionReference to a subcollection.
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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Starts listening to the document referenced by this DocumentReference with the given options
using an Activity-scoped listener.
| |||||||||||
Starts listening to the document referenced by this DocumentReference with the given options.
| |||||||||||
Starts listening to the document referenced by this DocumentReference.
| |||||||||||
Starts listening to the document referenced by this DocumentReference with the given options.
| |||||||||||
Starts listening to the document referenced by this DocumentReference.
| |||||||||||
Starts listening to the document referenced by this DocumentReference using an Activity-scoped
listener.
| |||||||||||
Gets a CollectionReference instance that refers to the subcollection at the specified path
relative to this document.
| |||||||||||
Deletes the document referred to by this DocumentReference.
| |||||||||||
Reads the document referenced by this DocumentReference
| |||||||||||
Gets the Firestore instance associated with this document reference.
| |||||||||||
Gets a CollectionReference to the collection that contains this document.
| |||||||||||
Gets the path of this document (relative to the root of the database) as a slash-separated
string.
| |||||||||||
Overwrites the document referred to by this DocumentReference.
| |||||||||||
Writes to the document referred to by this DocumentReference.
| |||||||||||
Writes to the document referred to by this DocumentReference.
| |||||||||||
Overwrites the document referred to by this DocumentReference.
| |||||||||||
Updates fields in the document referred to by this DocumentReference.
| |||||||||||
Updates fields in the document referred to by this DocumentReference.
| |||||||||||
Updates fields in the document referred to by this DocumentReference.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Starts listening to the document referenced by this DocumentReference with the given options using an Activity-scoped listener.
The listener will be automatically removed during onStop()
.
Parameters | |
---|---|
activity |
Activity : The activity to scope the listener to. |
options |
DocumentListenOptions : The options to use for this listen. |
listener |
EventListener : The event listener that will be called with the snapshots. |
Returns | |
---|---|
ListenerRegistration |
A registration object that can be used to remove the listener. |
Starts listening to the document referenced by this DocumentReference with the given options.
Parameters | |
---|---|
executor |
Executor : The executor to use to call the listener. |
options |
DocumentListenOptions : The options to use for this listen. |
listener |
EventListener : The event listener that will be called with the snapshots. |
Returns | |
---|---|
ListenerRegistration |
A registration object that can be used to remove the listener. |
Starts listening to the document referenced by this DocumentReference.
Parameters | |
---|---|
listener |
EventListener : The event listener that will be called with the snapshots. |
Returns | |
---|---|
ListenerRegistration |
A registration object that can be used to remove the listener. |
Starts listening to the document referenced by this DocumentReference with the given options.
Parameters | |
---|---|
options |
DocumentListenOptions : The options to use for this listen. |
listener |
EventListener : The event listener that will be called with the snapshots. |
Returns | |
---|---|
ListenerRegistration |
A registration object that can be used to remove the listener. |
Starts listening to the document referenced by this DocumentReference.
Parameters | |
---|---|
executor |
Executor : The executor to use to call the listener. |
listener |
EventListener : The event listener that will be called with the snapshots. |
Returns | |
---|---|
ListenerRegistration |
A registration object that can be used to remove the listener. |
Starts listening to the document referenced by this DocumentReference using an Activity-scoped listener.
The listener will be automatically removed during onStop()
.
Parameters | |
---|---|
activity |
Activity : The activity to scope the listener to. |
listener |
EventListener : The event listener that will be called with the snapshots. |
Returns | |
---|---|
ListenerRegistration |
A registration object that can be used to remove the listener. |
Gets a CollectionReference instance that refers to the subcollection at the specified path relative to this document.
Parameters | |
---|---|
collectionPath |
String : A slash-separated relative path to a subcollection. |
Returns | |
---|---|
CollectionReference |
The CollectionReference instance. |
Deletes the document referred to by this DocumentReference.
Returns | |
---|---|
Task<Void> |
A Task that will be resolved when the delete completes. |
Parameters | |
---|---|
o |
Object |
Returns | |
---|---|
boolean |
Reads the document referenced by this DocumentReference
Returns | |
---|---|
Task<DocumentSnapshot> |
A Task that will be resolved with the contents of the Document at this DocumentReference. |
Gets the Firestore instance associated with this document reference.
Returns | |
---|---|
FirebaseFirestore |
Returns | |
---|---|
String |
Gets a CollectionReference to the collection that contains this document.
Returns | |
---|---|
CollectionReference |
The CollectionReference that contains this document. |
Gets the path of this document (relative to the root of the database) as a slash-separated string.
Returns | |
---|---|
String |
The path of this document. |
Returns | |
---|---|
int |
Overwrites the document referred to by this DocumentReference. If the document does not yet exist, it will be created. If a document already exists, it will be overwritten.
Parameters | |
---|---|
pojo |
Object : The POJO that will be used to populate the document contents |
Returns | |
---|---|
Task<Void> |
A Task that will be resolved when the write finishes. |
Writes to the document referred to by this DocumentReference. If the document does not yet
exist, it will be created. If you pass SetOptions
, the provided data can be merged into
an existing document.
Parameters | |
---|---|
data |
Map : A map of the fields and values for the document. |
options |
SetOptions : An object to configure the set behavior. |
Returns | |
---|---|
Task<Void> |
A Task that will be resolved when the write finishes. |
Writes to the document referred to by this DocumentReference. If the document does not yet
exist, it will be created. If you pass SetOptions
, the provided data can be merged into
an existing document.
Parameters | |
---|---|
pojo |
Object : The POJO that will be used to populate the document contents |
options |
SetOptions : An object to configure the set behavior. |
Returns | |
---|---|
Task<Void> |
A Task that will be resolved when the write finishes. |
Overwrites the document referred to by this DocumentReference. If the document does not yet exist, it will be created. If a document already exists, it will be overwritten.
Parameters | |
---|---|
data |
Map : A map of the fields and values for the document. |
Returns | |
---|---|
Task<Void> |
A Task that will be resolved when the write finishes. |
Updates fields in the document referred to by this DocumentReference. If no document exists yet, the update will fail.
Parameters | |
---|---|
data |
Map : A map of field / value pairs to update. Fields can contain dots to reference nested
fields within the document. |
Returns | |
---|---|
Task<Void> |
A Task that will be resolved when the write finishes. |
Updates fields in the document referred to by this DocumentReference. If no document exists yet, the update will fail.
Parameters | |
---|---|
field |
String : The first field to update. Fields can contain dots to reference a nested field
within the document. |
value |
Object : The first value |
moreFieldsAndValues |
Object : Additional field/value pairs. |
Returns | |
---|---|
Task<Void> |
A Task that will be resolved when the write finishes. |
Updates fields in the document referred to by this DocumentReference. If no document exists yet, the update will fail.
Parameters | |
---|---|
fieldPath |
FieldPath : The first field to update. |
value |
Object : The first value |
moreFieldsAndValues |
Object : Additional field/value pairs. |
Returns | |
---|---|
Task<Void> |
A Task that will be resolved when the write finishes. |