firebase::firestore

CloudFirestore API.

Summary

CloudFirestore is a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud Platform.

Enumerations

AggregateSource{
  kServer
}
enum
The sources from whichAggregateQuery::Get can retrieve its results.
Error{
  kErrorOk = 0,
  kErrorCancelled = 1,
  kErrorUnknown = 2,
  kErrorInvalidArgument = 3,
  kErrorDeadlineExceeded = 4,
  kErrorNotFound = 5,
  kErrorAlreadyExists = 6,
  kErrorPermissionDenied = 7,
  kErrorResourceExhausted = 8,
  kErrorFailedPrecondition = 9,
  kErrorAborted = 10,
  kErrorOutOfRange = 11,
  kErrorUnimplemented = 12,
  kErrorInternal = 13,
  kErrorUnavailable = 14,
  kErrorDataLoss = 15,
  kErrorUnauthenticated = 16
}
enum
Error codes used by CloudFirestore.
MetadataChanges{
  kExclude,
  kInclude
}
enum
Indicates whether metadata-only changes (that is,DocumentSnapshot::metadata() orQuerySnapshot::metadata() changed) should trigger snapshot events.
Source{
  kDefault,
  kServer,
  kCache
}
enum
Configures the behavior ofDocumentReference::Get() andQuery::Get().

Typedefs

MapFieldPathValueusing
std::unordered_map<FieldPath,FieldValue >
A map ofFieldValues indexed by field paths.
MapFieldValueusing
std::unordered_map< std::string,FieldValue >
A map ofFieldValues indexed by stringified field paths.

Functions

operator!=(constSnapshotMetadata & lhs, constSnapshotMetadata & rhs)
bool
Checkslhs andrhs for inequality.
operator!=(constGeoPoint & lhs, constGeoPoint & rhs)
bool
Checkslhs andrhs for inequality.
operator!=(constSettings & lhs, constSettings & rhs)
bool
Checkslhs andrhs for inequality.
operator!=(constQuerySnapshot & lhs, constQuerySnapshot & rhs)
bool
Checkslhs andrhs for inequality.
operator!=(constQuery & lhs, constQuery & rhs)
bool
Checkslhs andrhs for inequality.
operator!=(constAggregateQuerySnapshot & lhs, constAggregateQuerySnapshot & rhs)
bool
Checkslhs andrhs for inequality.
operator!=(constDocumentReference & lhs, constDocumentReference & rhs)
bool
Checkslhs andrhs for inequality.
operator!=(constFieldValue & lhs, constFieldValue & rhs)
bool
Checkslhs andrhs for inequality.
operator!=(constFilter & lhs, constFilter & rhs)
bool
Checkslhs andrhs for inequality.
operator!=(constDocumentChange & lhs, constDocumentChange & rhs)
bool
Checkslhs andrhs for inequality.
operator!=(constSetOptions & lhs, constSetOptions & rhs)
bool
Checkslhs andrhs for inequality.
operator!=(constLoadBundleTaskProgress & lhs, constLoadBundleTaskProgress & rhs)
bool
LoadBundleTaskProgress != comparison operator.
operator!=(constAggregateQuery & lhs, constAggregateQuery & rhs)
bool
Checkslhs andrhs for inequality.
operator!=(constDocumentSnapshot & lhs, constDocumentSnapshot & rhs)
bool
Checkslhs andrhs for inequality.
operator!=(constTransactionOptions & lhs, constTransactionOptions & rhs)
bool
Compares twoTransactionOptions objects for inequality.
operator<(constGeoPoint & lhs, constGeoPoint & rhs)
bool
Checks whetherlhs andrhs are in ascending order.
operator<=(constGeoPoint & lhs, constGeoPoint & rhs)
bool
Checks whetherlhs andrhs are in non-descending order.
operator==(constSnapshotMetadata & lhs, constSnapshotMetadata & rhs)
bool
Checkslhs andrhs for equality.
operator==(constGeoPoint & lhs, constGeoPoint & rhs)
bool
Checkslhs andrhs for equality.
operator==(constSettings & lhs, constSettings & rhs)
bool
Checkslhs andrhs for equality.
operator==(constQuerySnapshot & lhs, constQuerySnapshot & rhs)
bool
Checkslhs andrhs for equality.
operator==(constQuery & lhs, constQuery & rhs)
bool
Checkslhs andrhs for equality.
operator==(constAggregateQuerySnapshot & lhs, constAggregateQuerySnapshot & rhs)
bool
Checkslhs andrhs for equality.
operator==(constDocumentReference & lhs, constDocumentReference & rhs)
bool
Checkslhs andrhs for equality.
operator==(constFieldValue & lhs, constFieldValue & rhs)
bool
Checkslhs andrhs for equality.
operator==(constFilter & lhs, constFilter & rhs)
bool
Checkslhs andrhs for equality.
operator==(constDocumentChange & lhs, constDocumentChange & rhs)
bool
Checkslhs andrhs for equality.
operator==(constSetOptions & lhs, constSetOptions & rhs)
bool
Checkslhs andrhs for equality.
operator==(constLoadBundleTaskProgress & lhs, constLoadBundleTaskProgress & rhs)
bool
LoadBundleTaskProgress == comparison operator.
operator==(constAggregateQuery & lhs, constAggregateQuery & rhs)
bool
Checkslhs andrhs for equality.
operator==(constDocumentSnapshot & lhs, constDocumentSnapshot & rhs)
bool
Checkslhs andrhs for equality.
operator==(constTransactionOptions &, constTransactionOptions &)
bool
Compares twoTransactionOptions objects for equality.
operator>(constGeoPoint & lhs, constGeoPoint & rhs)
bool
Checks whetherlhs andrhs are in descending order.
operator>=(constGeoPoint & lhs, constGeoPoint & rhs)
bool
Checks whetherlhs andrhs are in non-ascending order.

Classes

firebase::firestore::AggregateQuery

A query that calculates aggregations over an underlying query.

firebase::firestore::AggregateQuerySnapshot

The results of executing anAggregateQuery.

firebase::firestore::CollectionReference

ACollectionReference can be used for adding documents, getting document references, and querying for documents (using the methods inherited fromQuery).

firebase::firestore::DocumentChange

ADocumentChange represents a change to the documents matching a query.

firebase::firestore::DocumentReference

ADocumentReference refers to a document location in aFirestore database and can be used to write, read, or listen to the location.

firebase::firestore::DocumentSnapshot

ADocumentSnapshot contains data read from a document in yourFirestore database.

firebase::firestore::FieldPath

AFieldPath refers to a field in a document.

firebase::firestore::FieldValue

A field value represents variant datatypes as stored byFirestore.

firebase::firestore::Filter

AFilter represents a restriction on one or more field values and can be used to refine the results of aQuery.

firebase::firestore::Firestore

Entry point for the FirebaseFirestore C++ SDK.

firebase::firestore::GeoPoint

An immutable object representing a geographical point inFirestore.

firebase::firestore::ListenerRegistration

Represents a listener that can be removed by callingRemove().

firebase::firestore::LoadBundleTaskProgress

Represents a progress update or the final state from loading bundles.

firebase::firestore::Query

AQuery which you can read or listen to.

firebase::firestore::QuerySnapshot

AQuerySnapshot contains zero or moreDocumentSnapshot objects.

firebase::firestore::SetOptions

An options object that configures the behavior of Set() calls.

firebase::firestore::Settings

Settings used to configure aFirestore instance.

firebase::firestore::SnapshotMetadata

Metadata about a snapshot, describing the state of the snapshot.

firebase::firestore::Transaction

Transaction provides methods to read and write data within a transaction.

firebase::firestore::TransactionOptions

Options to customize transaction behavior forFirestore.runTransaction().

firebase::firestore::WriteBatch

A write batch is used to perform multiple writes as a single atomic unit.

Namespaces

firebase::firestore::csharp
firebase::firestore::model
firebase::firestore::util

Enumerations

AggregateSource

AggregateSource

The sources from whichAggregateQuery::Get can retrieve its results.

Properties
kServer

Perform the aggregation on the server and download the result.

The result received from the server is presented, unaltered, without considering any local state. That is, documents in the local cache are not taken into consideration, neither are local modifications not yet synchronized with the server. Previously-downloaded results, if any, are not used. Every request using this source necessarily involves a round trip to the server.

TheAggregateQuery will fail if the server cannot be reached, such as if the client is offline.

Error

Error

Error codes used by CloudFirestore.

The codes are in sync acrossFirestore SDKs on various platforms.

Properties
kErrorAborted

The operation was aborted, typically due to a concurrency issue like transaction aborts, etc.

kErrorAlreadyExists

Some document that we attempted to create already exists.

kErrorCancelled

The operation was cancelled (typically by the caller).

kErrorDataLoss

Unrecoverable data loss or corruption.

kErrorDeadlineExceeded

Deadline expired before operation could complete.

For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long enough for the deadline to expire.

kErrorFailedPrecondition

Operation was rejected because the system is not in a state required for the operation's execution.

kErrorInternal

Internal errors.

Means some invariants expected by underlying system has been broken. If you see one of these errors, something is very broken.

kErrorInvalidArgument

Client specified an invalid argument.

Note that this differs from FailedPrecondition. InvalidArgument indicates arguments that are problematic regardless of the state of the system (e.g., an invalid field name).

kErrorNotFound

Some requested document was not found.

kErrorOk

The operation completed successfully.

kErrorOutOfRange

Operation was attempted past the valid range.

kErrorPermissionDenied

The caller does not have permission to execute the specified operation.

kErrorResourceExhausted

Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.

kErrorUnauthenticated

The request does not have valid authentication credentials for the operation.

kErrorUnavailable

The service is currently unavailable.

This is a most likely a transient condition and may be corrected by retrying with a backoff.

kErrorUnimplemented

Operation is not implemented or not supported/enabled.

kErrorUnknown

Unknown error or an error from a different error domain.

MetadataChanges

MetadataChanges

Indicates whether metadata-only changes (that is,DocumentSnapshot::metadata() orQuerySnapshot::metadata() changed) should trigger snapshot events.

Properties
kExclude

Snapshot events will not be triggered by metadata-only changes.

kInclude

Snapshot events will be triggered by any changes, including metadata-only changes.

Source

Source

Configures the behavior ofDocumentReference::Get() andQuery::Get().

By providing a Source value, these methods can be configured to fetch results only from the server, only from the local cache, or attempt to fetch results from the server and fall back to the cache (which is the default).

Properties
kCache

CausesFirestore to immediately return a value from the cache, ignoring the server completely (implying that the returned value may be stale with respect to the value on the server).

If there is no data in the cache to satisfy theDocumentReference::Get() call will return an error andQuery::Get() will return an emptyQuerySnapshot with no documents.

kDefault

CausesFirestore to try to retrieve an up-to-date (server-retrieved) snapshot, but fall back to returning cached data if the server can't be reached.

kServer

CausesFirestore to avoid the cache, generating an error if the server cannot be reached.

Note that the cache will still be updated if the server request succeeds. Also note that latency-compensation still takes effect, so any pending write operations will be visible in the returned data (merged into the server-provided data).

Typedefs

MapFieldPathValue

std::unordered_map<FieldPath,FieldValue>MapFieldPathValue

A map ofFieldValues indexed by field paths.

MapFieldValue

std::unordered_map<std::string,FieldValue>MapFieldValue

A map ofFieldValues indexed by stringified field paths.

Functions

operator!=

booloperator!=(constSnapshotMetadata&lhs,constSnapshotMetadata&rhs)

Checkslhs andrhs for inequality.

operator!=

booloperator!=(constGeoPoint&lhs,constGeoPoint&rhs)

Checkslhs andrhs for inequality.

operator!=

booloperator!=(constSettings&lhs,constSettings&rhs)

Checkslhs andrhs for inequality.

operator!=

booloperator!=(constQuerySnapshot&lhs,constQuerySnapshot&rhs)

Checkslhs andrhs for inequality.

operator!=

booloperator!=(constQuery&lhs,constQuery&rhs)

Checkslhs andrhs for inequality.

operator!=

booloperator!=(constAggregateQuerySnapshot&lhs,constAggregateQuerySnapshot&rhs)

Checkslhs andrhs for inequality.

operator!=

booloperator!=(constDocumentReference&lhs,constDocumentReference&rhs)

Checkslhs andrhs for inequality.

operator!=

booloperator!=(constFieldValue&lhs,constFieldValue&rhs)

Checkslhs andrhs for inequality.

operator!=

booloperator!=(constFilter&lhs,constFilter&rhs)

Checkslhs andrhs for inequality.

operator!=

booloperator!=(constDocumentChange&lhs,constDocumentChange&rhs)

Checkslhs andrhs for inequality.

operator!=

booloperator!=(constSetOptions&lhs,constSetOptions&rhs)

Checkslhs andrhs for inequality.

operator!=

booloperator!=(constLoadBundleTaskProgress&lhs,constLoadBundleTaskProgress&rhs)

LoadBundleTaskProgress != comparison operator.

operator!=

booloperator!=(constAggregateQuery&lhs,constAggregateQuery&rhs)

Checkslhs andrhs for inequality.

operator!=

booloperator!=(constDocumentSnapshot&lhs,constDocumentSnapshot&rhs)

Checkslhs andrhs for inequality.

operator!=

booloperator!=(constTransactionOptions&lhs,constTransactionOptions&rhs)

Compares twoTransactionOptions objects for inequality.

operator<

booloperator<(constGeoPoint&lhs,constGeoPoint&rhs)

Checks whetherlhs andrhs are in ascending order.

operator<=

booloperator<=(constGeoPoint&lhs,constGeoPoint&rhs)

Checks whetherlhs andrhs are in non-descending order.

operator==

booloperator==(constSnapshotMetadata&lhs,constSnapshotMetadata&rhs)

Checkslhs andrhs for equality.

operator==

booloperator==(constGeoPoint&lhs,constGeoPoint&rhs)

Checkslhs andrhs for equality.

operator==

booloperator==(constSettings&lhs,constSettings&rhs)

Checkslhs andrhs for equality.

operator==

booloperator==(constQuerySnapshot&lhs,constQuerySnapshot&rhs)

Checkslhs andrhs for equality.

operator==

booloperator==(constQuery&lhs,constQuery&rhs)

Checkslhs andrhs for equality.

operator==

booloperator==(constAggregateQuerySnapshot&lhs,constAggregateQuerySnapshot&rhs)

Checkslhs andrhs for equality.

operator==

booloperator==(constDocumentReference&lhs,constDocumentReference&rhs)

Checkslhs andrhs for equality.

operator==

booloperator==(constFieldValue&lhs,constFieldValue&rhs)

Checkslhs andrhs for equality.

operator==

booloperator==(constFilter&lhs,constFilter&rhs)

Checkslhs andrhs for equality.

operator==

booloperator==(constDocumentChange&lhs,constDocumentChange&rhs)

Checkslhs andrhs for equality.

operator==

booloperator==(constSetOptions&lhs,constSetOptions&rhs)

Checkslhs andrhs for equality.

operator==

booloperator==(constLoadBundleTaskProgress&lhs,constLoadBundleTaskProgress&rhs)

LoadBundleTaskProgress == comparison operator.

operator==

booloperator==(constAggregateQuery&lhs,constAggregateQuery&rhs)

Checkslhs andrhs for equality.

operator==

booloperator==(constDocumentSnapshot&lhs,constDocumentSnapshot&rhs)

Checkslhs andrhs for equality.

operator==

booloperator==(constTransactionOptions&,constTransactionOptions&)

Compares twoTransactionOptions objects for equality.

operator>

booloperator>(constGeoPoint&lhs,constGeoPoint&rhs)

Checks whetherlhs andrhs are in descending order.

operator>=

booloperator>=(constGeoPoint&lhs,constGeoPoint&rhs)

Checks whetherlhs andrhs are in non-ascending order.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-11-18 UTC.