Package @google-cloud/firestore (7.6.0)

Classes

Aggregate

Concrete implementation of the Aggregate type.

AggregateField

Represents an aggregation that can be performed by Firestore.

AggregateQuery

A query that calculates aggregations over an underlying query.

AggregateQuerySnapshot

The results of executing an aggregation query.

BulkWriter

A Firestore BulkWriter that can be used to perform a large number of writes in parallel.

BulkWriter

BulkWriterError

The error thrown when a BulkWriter operation fails.

BulkWriterError

BundleBuilder

Builds a Firestore data bundle with results from the given document and query snapshots.

CollectionGroup

A CollectionGroup refers to all documents that are contained in a collection or subcollection with a specific collection ID.

CollectionGroup

CollectionReference

A CollectionReference object can be used for adding documents, getting document references, and querying for documents (using the methods inherited from [Query]Query).

CollectionReference Query

DocumentChange

A DocumentChange represents a change to the documents matching a query. It contains the document affected and the type of change that occurred.

DocumentChange

DocumentReference

A DocumentReference refers to a document location in a Firestore database and can be used to write, read, or listen to the location. The document at the referenced location may or may not exist. A DocumentReference can also be used to create a [CollectionReference]CollectionReference to a subcollection.

DocumentReference

DocumentSnapshot

A DocumentSnapshot is an immutable representation for a document in a Firestore database. The data can be extracted with [data()] or [get(fieldPath)] to get a specific field.

For a DocumentSnapshot that points to a non-existing document, any data access will return 'undefined'. You can use the [exists] property to explicitly verify a document's existence.

DocumentSnapshot

ExecutionStats

ExecutionStats contains information about the execution of a query.

ExecutionStats

ExplainMetrics

ExplainMetrics contains information about planning and execution of a query.

ExplainMetrics

ExplainResults

ExplainResults contains information about planning, execution, and results of a query.

ExplainResults

FieldPath

A dot-separated path for navigating sub-objects (e.g. nested maps) within a document.

FieldValue

Sentinel values that can be used when writing documents with set(), create() or update().

FieldValue

Filter

A Filter represents a restriction on one or more field values and can be used to refine the results of a Query. Filterss are created by invoking , , or and can then be passed to to create a new Query instance that also contains this Filter.

Firestore

The Firestore client represents a Firestore Database and is the entry point for all Firestore operations.

GeoPoint

An immutable object representing a geographic location in Firestore. The location is represented as a latitude/longitude pair.

PlanSummary

PlanSummary contains information about the planning stage of a query.

PlanSummary

Query

A Query refers to a query which you can read or stream from. You can also construct refined Query objects by adding filters and ordering.

Query

QueryDocumentSnapshot

A QueryDocumentSnapshot contains data read from a document in your Firestore database as part of a query. The document is guaranteed to exist and its data can be extracted with [data()] or [get()] to get a specific field.

A QueryDocumentSnapshot offers the same API surface as a DocumentSnapshot. Since query results contain only existing documents, the [exists] property will always be true and [data()] will never return 'undefined'.

QueryDocumentSnapshot DocumentSnapshot

QueryPartition

A split point that can be used in a query as a starting and/or end point for the query results. The cursors returned by and can only be used in a query that matches the constraint of query that produced this partition.

QueryPartition

QuerySnapshot

A QuerySnapshot contains zero or more [QueryDocumentSnapshot]QueryDocumentSnapshot objects representing the results of a query. The documents can be accessed as an array via the [documents] property or enumerated using the [forEach] method. The number of documents can be determined via the [empty] and [size] properties.

QuerySnapshot

Timestamp

A Timestamp represents a point in time independent of any time zone or calendar, represented as seconds and fractions of seconds at nanosecond resolution in UTC Epoch time. It is encoded using the Proleptic Gregorian Calendar which extends the Gregorian calendar backwards to year one. It is encoded assuming all minutes are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.

Transaction

A reference to a transaction.

The Transaction object passed to a transaction's updateFunction provides the methods to read and write data within the transaction context. See [runTransaction()].

Transaction

VectorQuery

A query that finds the documents whose vector fields are closest to a certain query vector. Create an instance of VectorQuery with Query.findNearest().

VectorQuerySnapshot

A VectorQuerySnapshot contains zero or more QueryDocumentSnapshot objects representing the results of a query. The documents can be accessed as an array via the docs property or enumerated using the forEach method. The number of documents can be determined via the empty and size properties.

VectorValue

Represent a vector type in Firestore documents. Create an instance with FieldValue.vector().

VectorValue

WriteBatch

A Firestore WriteBatch that can be used to atomically commit multiple write operations at once.

WriteBatch

WriteResult

A WriteResult wraps the write time set by the Firestore servers on sets(), updates(), and creates().

WriteResult

Interfaces

AggregateSpec

A type whose property values are all AggregateField objects.

Variables

DEFAULT_MAX_TRANSACTION_ATTEMPTS

DEFAULT_MAX_TRANSACTION_ATTEMPTS = 5

The maximum number of times to attempt a transaction before failing.

MAX_REQUEST_RETRIES

MAX_REQUEST_RETRIES = 5

The maximum number of times to retry idempotent requests.

Functions

setLogFunction(logger)

export declare function setLogFunction(logger: ((msg: string) => void) | null): void;

Sets or disables the log function for all active Firestore instances.

Parameter
NameDescription
logger((msg: string) => void) | null

A log function that takes a message (such as console.log) or null to turn off logging.

Returns
TypeDescription
void

Type Aliases

AggregateFieldType

export type AggregateFieldType = ReturnType

The union of all AggregateField types that are supported by Firestore.

AggregateType

export type AggregateType = 'count' | 'avg' | 'sum';

Union type representing the aggregate type to be performed.

DocumentChangeType

export type DocumentChangeType = 'added' | 'removed' | 'modified';