DocumentSnapshot(const DocumentSnapshot & other)
DocumentSnapshot(DocumentSnapshot && other)
~DocumentSnapshot()
Public types | |
---|---|
ServerTimestampBehavior{ | enum Controls the return value for server timestamps that have not yet been set to their final value. |
Friend classes | |
---|---|
operator<< | friend std::ostream & Outputs the string representation of this DocumentSnapshot to the given stream. |
Public functions | |
---|---|
Get(const char *field, ServerTimestampBehavior stb) const | virtual FieldValue Retrieves a specific field from the document. |
Get(const std::string & field, ServerTimestampBehavior stb) const | virtual FieldValue Retrieves a specific field from the document. |
Get(const FieldPath & field, ServerTimestampBehavior stb) const | virtual FieldValue Retrieves a specific field from the document. |
GetData(ServerTimestampBehavior stb) const | virtual MapFieldValue Retrieves all fields in the document as a map of FieldValues. |
ToString() const | std::string Returns a string representation of this DocumentSnapshot for logging/debugging purposes. |
exists() const | virtual bool Explicitly verify a document's existence. |
id() const | virtual const std::string & Returns the string ID of the document for which this DocumentSnapshot contains data. |
is_valid() const | bool Returns true if this DocumentSnapshot is valid, false if it is not valid. |
metadata() const | virtual SnapshotMetadata Returns the metadata about this snapshot concerning its source and if it has local modifications. |
operator=(const DocumentSnapshot & other) | Copy assignment operator. |
operator=(DocumentSnapshot && other) | Move assignment operator. |
reference() const | virtual DocumentReference Returns the document location for which this DocumentSnapshot contains data. |
ServerTimestampBehavior
Controls the return value for server timestamps that have not yet been set to their final value.
friendstd::ostream&operator<<(std::ostream&out,constDocumentSnapshot&document)
Outputs the string representation of this DocumentSnapshot
to the given stream.
See also:ToString()
for comments on the representation format.
DocumentSnapshot()
Creates an invalid DocumentSnapshot that has to be reassigned before it can be used.
Calling any member function on an invalid DocumentSnapshot 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.
DocumentSnapshot(constDocumentSnapshot&other)
Copy constructor.
DocumentSnapshot
is immutable and can be efficiently copied (no deep copy is performed).
Details | |||
---|---|---|---|
Parameters |
|
DocumentSnapshot(DocumentSnapshot&&other)
Move constructor.
Moving is more efficient than copying for a DocumentSnapshot
. After being moved from, a DocumentSnapshot
is equivalent to its default-constructed state.
Details | |||
---|---|---|---|
Parameters |
|
virtualFieldValueGet(constchar*field,ServerTimestampBehaviorstb)const
Retrieves a specific field from the document.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | The value contained in the field. If the field does not exist in the document, then a FieldValue instance with is_valid() == false will be returned. |
virtualFieldValueGet(conststd::string&field,ServerTimestampBehaviorstb)const
Retrieves a specific field from the document.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | The value contained in the field. If the field does not exist in the document, then a FieldValue instance with is_valid() == false will be returned. |
virtualFieldValueGet(constFieldPath&field,ServerTimestampBehaviorstb)const
Retrieves a specific field from the document.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | The value contained in the field. If the field does not exist in the document, then a FieldValue instance with is_valid() == false will be returned. |
virtualMapFieldValueGetData(ServerTimestampBehaviorstb)const
Retrieves all fields in the document as a map of FieldValues.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A map containing all fields in the document, or an empty map if the document doesn't exist. |
std::stringToString()const
Returns a string representation of this DocumentSnapshot
for logging/debugging purposes.
virtualboolexists()const
Explicitly verify a document's existence.
Details | |
---|---|
Returns | True if the document exists in this snapshot. |
virtualconststd::string&id()const
Returns the string ID of the document for which this DocumentSnapshot contains data.
Details | |
---|---|
Returns | String ID of this document location. |
boolis_valid()const
Returns true if this DocumentSnapshot
is valid, false if it is not valid.
An invalid DocumentSnapshot
could be the result of:
DocumentSnapshot
with the default constructor.DocumentSnapshot
.DocumentSnapshot
instances associated with it.Details | |
---|---|
Returns | true if this DocumentSnapshot is valid, false if this DocumentSnapshot is invalid. |
virtualSnapshotMetadatametadata()const
Returns the metadata about this snapshot concerning its source and if it has local modifications.
Details | |
---|---|
Returns | SnapshotMetadata about this snapshot. |
DocumentSnapshot&operator=(constDocumentSnapshot&other)
Copy assignment operator.
DocumentSnapshot
is immutable and can be efficiently copied (no deep copy is performed).
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | Reference to the destination DocumentSnapshot . |
DocumentSnapshot&operator=(DocumentSnapshot&&other)
Move assignment operator.
Moving is more efficient than copying for a DocumentSnapshot
. After being moved from, a DocumentSnapshot
is equivalent to its default-constructed state.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | Reference to the destination DocumentSnapshot . |
virtualDocumentReferencereference()const
Returns the document location for which this DocumentSnapshot contains data.
Details | |
---|---|
Returns | DocumentReference of this document location. |
virtual~DocumentSnapshot()
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.