Firebase. Firestore. DocumentReference
A DocumentReference
refers to a document location in a Cloud Firestore database and can be used to write, read, or listen to the location.
Summary
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.
Inheritance
Inherits from: IEquatable< DocumentReference >
Properties |
|
---|---|
Firestore
|
The database which contains the document.
|
Public attributes |
|
---|---|
Id => _proxy.id()
|
string
The final part of the complete document path; this is the identity of the document relative to its parent collection.
|
Parent => new CollectionReference(_proxy.Parent(), Firestore)
|
The parent collection.
|
Path => _proxy.path()
|
string
The complete document path, not including project and database ID.
|
Public functions |
|
---|---|
Collection(string path)
|
Creates a CollectionReference for a child collection of this document.
|
DeleteAsync()
|
Task
Asynchronously deletes the document referred to by this
DocumentReference . |
Equals(object obj)
|
override bool
|
Equals(DocumentReference other)
|
bool
|
GetHashCode()
|
override int
|
GetSnapshotAsync(Source source)
|
Task< DocumentSnapshot >
Asynchronously fetches a snapshot of the document.
|
Listen(Action< DocumentSnapshot > callback)
|
Starts listening to changes to the document referenced by this
DocumentReference . |
Listen(MetadataChanges metadataChanges, Action< DocumentSnapshot > callback)
|
Starts listening to changes to the document referenced by this
DocumentReference . |
SetAsync(object documentData, SetOptions options)
|
Task
Asynchronously sets data in the document, either replacing it completely or merging fields.
|
ToString()
|
override string
|
UpdateAsync(IDictionary< string, object > updates)
|
Task
Asynchronously performs a set of updates on the document referred to by this
DocumentReference . |
UpdateAsync(string field, object value)
|
Task
Asynchronously performs a single field update on the document referred to by this
DocumentReference . |
UpdateAsync(IDictionary< FieldPath, object > updates)
|
Task
Asynchronously performs a set of updates on the document referred to by this
DocumentReference . |
Properties
Public attributes
Id
string Id => _proxy.id()
The final part of the complete document path; this is the identity of the document relative to its parent collection.
Parent
CollectionReference Parent => new CollectionReference(_proxy.Parent(), Firestore)
The parent collection.
Never null
.
Path
string Path => _proxy.path()
The complete document path, not including project and database ID.
Public functions
Collection
CollectionReference Collection( string path )
Creates a CollectionReference for a child collection of this document.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
A CollectionReference for the specified collection.
|
DeleteAsync
Task DeleteAsync()
Asynchronously deletes the document referred to by this DocumentReference
.
Details | |
---|---|
Returns |
The write result of the server operation. The task will not complete while the client is offline, though local changes will be visible immediately.
|
Equals
override bool Equals( object obj )
Equals
bool Equals( DocumentReference other )
GetHashCode
override int GetHashCode()
GetSnapshotAsync
Task< DocumentSnapshot > GetSnapshotAsync( Source source )
Asynchronously fetches a snapshot of the document.
By default, GetSnapshotAsync
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 source
parameter.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
A snapshot of the document. The snapshot may represent a missing document.
|
Listen
ListenerRegistration Listen( Action< DocumentSnapshot > callback )
Starts listening to changes to the document referenced by this DocumentReference
.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
A ListenerRegistration which may be used to stop listening gracefully.
|
Listen
ListenerRegistration Listen( MetadataChanges metadataChanges, Action< DocumentSnapshot > callback )
Starts listening to changes to the document referenced by this DocumentReference
.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
A ListenerRegistration which may be used to stop listening gracefully.
|
SetAsync
Task SetAsync( object documentData, SetOptions options )
Asynchronously sets data in the document, either replacing it completely or merging fields.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
The write result of the server operation. The task will not complete while the client is offline, though local changes will be visible immediately.
|
ToString
override string ToString()
UpdateAsync
Task UpdateAsync( IDictionary< string, object > updates )
Asynchronously performs a set of updates on the document referred to by this DocumentReference
.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The write result of the server operation. The task will not complete while the client is offline, though local changes will be visible immediately.
|
UpdateAsync
Task UpdateAsync( string field, object value )
Asynchronously performs a single field update on the document referred to by this DocumentReference
.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
The write result of the server operation. The task will not complete while the client is offline, though local changes will be visible immediately.
|
UpdateAsync
Task UpdateAsync( IDictionary< FieldPath, object > updates )
Asynchronously performs a set of updates on the document referred to by this DocumentReference
.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The write result of the server operation. The task will not complete while the client is offline, though local changes will be visible immediately.
|