Konsola git

DocumentReference

public class DocumentReference extends Object

A DocumentReference refers to a document location in a Cloud 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: Cloud 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 Method Summary

ListenerRegistration
addSnapshotListener(Activity activity, MetadataChanges metadataChanges, EventListener<DocumentSnapshot> listener)
Starts listening to the document referenced by this DocumentReference with the given options using an Activity-scoped listener.
ListenerRegistration
addSnapshotListener(Executor executor, MetadataChanges metadataChanges, EventListener<DocumentSnapshot> listener)
Starts listening to the document referenced by this DocumentReference with the given options.
ListenerRegistration
addSnapshotListener(MetadataChanges metadataChanges, EventListener<DocumentSnapshot> listener)
Starts listening to the document referenced by this DocumentReference with the given options.
ListenerRegistration
addSnapshotListener(EventListener<DocumentSnapshot> listener)
Starts listening to the document referenced by this DocumentReference.
ListenerRegistration
addSnapshotListener(Executor executor, EventListener<DocumentSnapshot> listener)
Starts listening to the document referenced by this DocumentReference.
ListenerRegistration
addSnapshotListener(Activity activity, EventListener<DocumentSnapshot> listener)
Starts listening to the document referenced by this DocumentReference using an Activity-scoped listener.
CollectionReference
collection(String collectionPath)
Gets a CollectionReference instance that refers to the subcollection at the specified path relative to this document.
Task<Void>
delete()
Deletes the document referred to by this DocumentReference.
boolean
Task<DocumentSnapshot>
get()
Reads the document referenced by this DocumentReference.
Task<DocumentSnapshot>
get(Source source)
Reads the document referenced by this DocumentReference.
FirebaseFirestore
getFirestore()
Gets the Cloud Firestore instance associated with this document reference.
String
CollectionReference
getParent()
Gets a CollectionReference to the collection that contains this document.
String
getPath()
Gets the path of this document (relative to the root of the database) as a slash-separated string.
int
Task<Void>
set(Object data)
Overwrites the document referred to by this DocumentReference.
Task<Void>
set(Object data, SetOptions options)
Writes to the document referred to by this DocumentReference.
Task<Void>
update(Map<StringObject> data)
Updates fields in the document referred to by this DocumentReference.
Task<Void>
update(String field, Object value, Object... moreFieldsAndValues)
Updates fields in the document referred to by this DocumentReference.
Task<Void>
update(FieldPath fieldPath, Object value, Object... moreFieldsAndValues)
Updates fields in the document referred to by this DocumentReference.

Inherited Method Summary