DocumentReference(const DocumentReference & other)
DocumentReference(DocumentReference && other)
~DocumentReference()
Friend classes | |
---|---|
operator<< | friend std::ostream & Outputs the string representation of this DocumentReference to the given stream. |
Public functions | |
---|---|
AddSnapshotListener(std::function< void(const DocumentSnapshot &, Error, const std::string &)> callback) | virtual ListenerRegistration Starts listening to the document referenced by this DocumentReference. |
AddSnapshotListener(MetadataChanges metadata_changes, std::function< void(const DocumentSnapshot &, Error, const std::string &)> callback) | virtual ListenerRegistration Starts listening to the document referenced by this DocumentReference. |
Collection(const char *collection_path) const | virtual CollectionReference Returns a CollectionReference instance that refers to the subcollection at the specified path relative to this document. |
Collection(const std::string & collection_path) const | virtual CollectionReference Returns a CollectionReference instance that refers to the subcollection at the specified path relative to this document. |
Delete() | virtual Future< void > Removes the document referred to by this DocumentReference. |
Get(Source source) const | virtual Future< DocumentSnapshot > Reads the document referenced by this DocumentReference. |
Parent() const | virtual CollectionReference Returns a CollectionReference to the collection that contains this document. |
Set(const MapFieldValue & data, const SetOptions & options) | virtual Future< void > Writes to the document referred to by this DocumentReference. |
ToString() const | std::string Returns a string representation of this DocumentReference for logging/debugging purposes. |
Update(const MapFieldValue & data) | virtual Future< void > Updates fields in the document referred to by this DocumentReference. |
Update(const MapFieldPathValue & data) | virtual Future< void > Updates fields in the document referred to by this DocumentReference. |
firestore() const | virtual const Firestore * Returns the Firestore instance associated with this document reference. |
firestore() | virtual Firestore * Returns the Firestore instance associated with this document reference. |
id() const | virtual const std::string & Returns the string ID of this document location. |
is_valid() const | bool Returns true if this DocumentReference is valid, false if it is not valid. |
operator=(const DocumentReference & other) | Copy assignment operator. |
operator=(DocumentReference && other) | Move assignment operator. |
path() const | virtual std::string Returns the path of this document (relative to the root of the database) as a slash-separated string. |
friendstd::ostream&operator<<(std::ostream&out,constDocumentReference&reference)
Outputs the string representation of this DocumentReference
to the given stream.
See also:ToString()
for comments on the representation format.
virtualListenerRegistrationAddSnapshotListener(std::function<void(constDocumentSnapshot&,Error,conststd::string&)>callback)
Starts listening to the document referenced by this DocumentReference.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A registration object that can be used to remove the listener. |
virtualListenerRegistrationAddSnapshotListener(MetadataChangesmetadata_changes,std::function<void(constDocumentSnapshot&,Error,conststd::string&)>callback)
Starts listening to the document referenced by this DocumentReference.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A registration object that can be used to remove the listener. |
virtualCollectionReferenceCollection(constchar*collection_path)const
Returns a CollectionReference instance that refers to the subcollection at the specified path relative to this document.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | The CollectionReference instance. |
virtualCollectionReferenceCollection(conststd::string&collection_path)const
Returns a CollectionReference instance that refers to the subcollection at the specified path relative to this document.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | The CollectionReference instance. |
virtualFuture<void>Delete()
Removes the document referred to by this DocumentReference.
Details | |
---|---|
Returns | A Future that will be resolved when the delete completes. |
DocumentReference()
Creates an invalid DocumentReference that has to be reassigned before it can be used.
Calling any member function on an invalid DocumentReference will be a no-op. If the function returns a value, it will return a zero, empty, or invalid value, depending on the type of the value.
DocumentReference(constDocumentReference&other)
Copy constructor.
DocumentReference
can be efficiently copied because it simply refers to a location in the database.
Details | |||
---|---|---|---|
Parameters |
|
DocumentReference(DocumentReference&&other)
Move constructor.
Moving is more efficient than copying for a DocumentReference
. After being moved from, a DocumentReference
is equivalent to its default-constructed state.
Details | |||
---|---|---|---|
Parameters |
|
virtualFuture<DocumentSnapshot>Get(Sourcesource)const
Reads the document referenced by this DocumentReference.
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 Source parameter.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A Future that will be resolved with the contents of the Document at this DocumentReference. |
virtualCollectionReferenceParent()const
Returns a CollectionReference to the collection that contains this document.
virtualFuture<void>Set(constMapFieldValue&data,constSetOptions&options)
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.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A Future that will be resolved when the write finishes. |
std::stringToString()const
Returns a string representation of this DocumentReference
for logging/debugging purposes.
virtualFuture<void>Update(constMapFieldValue&data)
Updates fields in the document referred to by this DocumentReference.
If no document exists yet, the update will fail.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A Future that will be resolved when the client is online and the commit has completed against the server. The future will not resolve when the device is offline, though local changes will be visible immediately. |
virtualFuture<void>Update(constMapFieldPathValue&data)
Updates fields in the document referred to by this DocumentReference.
If no document exists yet, the update will fail.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A Future that will be resolved when the client is online and the commit has completed against the server. The future will not resolve when the device is offline, though local changes will be visible immediately. |
virtualconstFirestore*firestore()const
Returns the Firestore instance associated with this document reference.
The pointer will remain valid indefinitely.
Details | |
---|---|
Returns | Firebase Firestore instance that this DocumentReference refers to. |
virtualFirestore*firestore()
Returns the Firestore instance associated with this document reference.
The pointer will remain valid indefinitely.
Details | |
---|---|
Returns | Firebase Firestore instance that this DocumentReference refers to. |
virtualconststd::string&id()const
Returns the string ID of this document location.
Details | |
---|---|
Returns | String ID of this document location. |
boolis_valid()const
Returns true if this DocumentReference
is valid, false if it is not valid.
An invalid DocumentReference
could be the result of:
DocumentReference
using the default constructor.DocumentReference
.CollectionReference::Parent()
on a CollectionReference
that is not a subcollection.DocumentReference
instances associated with it.Details | |
---|---|
Returns | true if this DocumentReference is valid, false if this DocumentReference is invalid. |
DocumentReference&operator=(constDocumentReference&other)
Copy assignment operator.
DocumentReference
can be efficiently copied because it simply refers to a location in the database.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | Reference to the destination DocumentReference . |
DocumentReference&operator=(DocumentReference&&other)
Move assignment operator.
Moving is more efficient than copying for a DocumentReference
. After being moved from, a DocumentReference
is equivalent to its default-constructed state.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | Reference to the destination DocumentReference . |
virtualstd::stringpath()const
Returns the path of this document (relative to the root of the database) as a slash-separated string.
Details | |
---|---|
Returns | String path of this document location. |
virtual~DocumentReference()
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-01-23 UTC.