Properties

static

Direction  number

A sort direction.

Properties

Name Type Optional Description

DIRECTION_UNSPECIFIED

 

 

Unspecified.

ASCENDING

 

 

Ascending.

DESCENDING

 

 

Descending.

static

Operator  number

A unary operator.

Properties

Name Type Optional Description

OPERATOR_UNSPECIFIED

 

 

Unspecified. This value must not be used.

IS_NAN

 

 

Test if a field is equal to NaN.

IS_NULL

 

 

Test if an exprestion evaluates to Null.

static

Operator  number

A field filter operator.

Properties

Name Type Optional Description

OPERATOR_UNSPECIFIED

 

 

Unspecified. This value must not be used.

LESS_THAN

 

 

Less than. Requires that the field come first in order_by.

LESS_THAN_OR_EQUAL

 

 

Less than or equal. Requires that the field come first in order_by.

GREATER_THAN

 

 

Greater than. Requires that the field come first in order_by.

GREATER_THAN_OR_EQUAL

 

 

Greater than or equal. Requires that the field come first in order_by.

EQUAL

 

 

Equal.

ARRAY_CONTAINS

 

 

Contains. Requires that the field is an array.

static

Operator  number

A composite filter operator.

Properties

Name Type Optional Description

OPERATOR_UNSPECIFIED

 

 

Unspecified. This value must not be used.

AND

 

 

The results are required to satisfy each of the combined filters.

static

ServerValue  number

A value that is calculated by the server.

Properties

Name Type Optional Description

SERVER_VALUE_UNSPECIFIED

 

 

Unspecified. This value must not be used.

REQUEST_TIME

 

 

The time at which the server processed the request, with millisecond precision.

static

TargetChangeType  number

The type of change.

Properties

Name Type Optional Description

NO_CHANGE

 

 

No change has occurred. Used only to send an updated resume_token.

ADD

 

 

The targets have been added.

REMOVE

 

 

The targets have been removed.

CURRENT

 

 

The targets reflect all changes committed before the targets were added to the stream.

This will be sent after or with a read_time that is greater than or equal to the time at which the targets were added.

Listeners can wait for this change if read-after-write semantics are desired.

RESET

 

 

The targets have been reset, and a new initial state for the targets will be returned in subsequent changes.

After the initial state is complete, CURRENT will be returned even if the target was previously indicated to be CURRENT.

Abstract types

static

ArrayValue

An array value.

Property

Name Type Optional Description

values

Array of Object

 

Values in the array.

This object should have the same structure as Value

See also

google.firestore.v1beta1.ArrayValue definition in proto format

static

BatchGetDocumentsRequest

The request for Firestore.BatchGetDocuments.

Properties

Name Type Optional Description

database

string

 

The database name. In the format: projects/{project_id}/databases/{database_id}.

documents

Array of string

 

The names of the documents to retrieve. In the format: projects/{project_id}/databases/{database_id}/documents/{document_path}. The request will fail if any of the document is not a child resource of the given database. Duplicate names will be elided.

mask

Object

 

The fields to return. If not set, returns all fields.

If a document has a field that is not present in this mask, that field will not be returned in the response.

This object should have the same structure as DocumentMask

transaction

string

 

Reads documents in a transaction.

newTransaction

Object

 

Starts a new transaction and reads the documents. Defaults to a read-only transaction. The new transaction ID will be returned as the first response in the stream.

This object should have the same structure as TransactionOptions

readTime

Object

 

Reads documents as they were at the given time. This may not be older than 60 seconds.

This object should have the same structure as Timestamp

See also

google.firestore.v1beta1.BatchGetDocumentsRequest definition in proto format

static

BatchGetDocumentsResponse

The streamed response for Firestore.BatchGetDocuments.

Properties

Name Type Optional Description

found

Object

 

A document that was requested.

This object should have the same structure as Document

missing

string

 

A document name that was requested but does not exist. In the format: projects/{project_id}/databases/{database_id}/documents/{document_path}.

transaction

string

 

The transaction that was started as part of this request. Will only be set in the first response, and only if BatchGetDocumentsRequest.new_transaction was set in the request.

readTime

Object

 

The time at which the document was read. This may be monotically increasing, in this case the previous documents in the result stream are guaranteed not to have changed between their read_time and this one.

This object should have the same structure as Timestamp

See also

google.firestore.v1beta1.BatchGetDocumentsResponse definition in proto format

static

BeginTransactionRequest

The request for Firestore.BeginTransaction.

Properties

Name Type Optional Description

database

string

 

The database name. In the format: projects/{project_id}/databases/{database_id}.

options

Object

 

The options for the transaction. Defaults to a read-write transaction.

This object should have the same structure as TransactionOptions

See also

google.firestore.v1beta1.BeginTransactionRequest definition in proto format

static

BeginTransactionResponse

The response for Firestore.BeginTransaction.

Property

Name Type Optional Description

transaction

string

 

The transaction that was started.

See also

google.firestore.v1beta1.BeginTransactionResponse definition in proto format

static

CollectionSelector

A selection of a collection, such as messages as m1.

Properties

Name Type Optional Description

collectionId

string

 

The collection ID. When set, selects only collections with this ID.

allDescendants

boolean

 

When false, selects only collections that are immediate children of the parent specified in the containing RunQueryRequest. When true, selects all descendant collections.

See also

google.firestore.v1beta1.StructuredQuery.CollectionSelector definition in proto format

static

CommitRequest

The request for Firestore.Commit.

Properties

Name Type Optional Description

database

string

 

The database name. In the format: projects/{project_id}/databases/{database_id}.

writes

Array of Object

 

The writes to apply.

Always executed atomically and in order.

This object should have the same structure as Write

transaction

string

 

If set, applies all writes in this transaction, and commits it.

See also

google.firestore.v1beta1.CommitRequest definition in proto format

static

CommitResponse

The response for Firestore.Commit.

Properties

Name Type Optional Description

writeResults

Array of Object

 

The result of applying the writes.

This i-th write result corresponds to the i-th write in the request.

This object should have the same structure as WriteResult

commitTime

Object

 

The time at which the commit occurred.

This object should have the same structure as Timestamp

See also

google.firestore.v1beta1.CommitResponse definition in proto format

static

CompositeFilter

A filter that merges multiple other filters using the given operator.

Properties

Name Type Optional Description

op

number

 

The operator for combining multiple filters.

The number should be among the values of Operator

filters

Array of Object

 

The list of filters to combine. Must contain at least one filter.

This object should have the same structure as Filter

See also

google.firestore.v1beta1.StructuredQuery.CompositeFilter definition in proto format

static

CreateDocumentRequest

The request for Firestore.CreateDocument.

Properties

Name Type Optional Description

parent

string

 

The parent resource. For example: projects/{project_id}/databases/{database_id}/documents or projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}

collectionId

string

 

The collection ID, relative to parent, to list. For example: chatrooms.

documentId

string

 

The client-assigned document ID to use for this document.

Optional. If not specified, an ID will be assigned by the service.

document

Object

 

The document to create. name must not be set.

This object should have the same structure as Document

mask

Object

 

The fields to return. If not set, returns all fields.

If the document has a field that is not present in this mask, that field will not be returned in the response.

This object should have the same structure as DocumentMask

See also

google.firestore.v1beta1.CreateDocumentRequest definition in proto format

static

Cursor

A position in a query result set.

Properties

Name Type Optional Description

values

Array of Object

 

The values that represent a position, in the order they appear in the order by clause of a query.

Can contain fewer values than specified in the order by clause.

This object should have the same structure as Value

before

boolean

 

If the position is just before or just after the given values, relative to the sort order defined by the query.

See also

google.firestore.v1beta1.Cursor definition in proto format

static

DeleteDocumentRequest

The request for Firestore.DeleteDocument.

Properties

Name Type Optional Description

name

string

 

The resource name of the Document to delete. In the format: projects/{project_id}/databases/{database_id}/documents/{document_path}.

currentDocument

Object

 

An optional precondition on the document. The request will fail if this is set and not met by the target document.

This object should have the same structure as Precondition

See also

google.firestore.v1beta1.DeleteDocumentRequest definition in proto format

static

Document

A Firestore document.

Must not exceed 1 MiB - 4 bytes.

Properties

Name Type Optional Description

name

string

 

The resource name of the document, for example projects/{project_id}/databases/{database_id}/documents/{document_path}.

fields

Object with Object properties

 

The document's fields.

The map keys represent field names.

A simple field name contains only characters a to z, A to Z, 0 to 9, or _, and must not start with 0 to 9. For example, foo_bar_17.

Field names matching the regular expression __.*__ are reserved. Reserved field names are forbidden except in certain documented contexts. The map keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be empty.

Field paths may be used in other contexts to refer to structured fields defined here. For map_value, the field path is represented by the simple or quoted field names of the containing fields, delimited by .. For example, the structured field "foo" : { map_value: { "x&y" : { string_value: "hello" }}} would be represented by the field path foo.x&y.

Within a field path, a quoted field name starts and ends with ` and may contain any character. Some characters, including `, must be escaped using a \. For example, `x&y` represents x&y and `bak\`tik` represents bak`tik.

createTime

Object

 

Output only. The time at which the document was created.

This value increases monotonically when a document is deleted then recreated. It can also be compared to values from other documents and the read_time of a query.

This object should have the same structure as Timestamp

updateTime

Object

 

Output only. The time at which the document was last changed.

This value is initially set to the create_time then increases monotonically with each change to the document. It can also be compared to values from other documents and the read_time of a query.

This object should have the same structure as Timestamp

See also

google.firestore.v1beta1.Document definition in proto format

static

DocumentChange

A Document has changed.

May be the result of multiple writes, including deletes, that ultimately resulted in a new value for the Document.

Multiple DocumentChange messages may be returned for the same logical change, if multiple targets are affected.

Properties

Name Type Optional Description

document

Object

 

The new state of the Document.

If mask is set, contains only fields that were updated or added.

This object should have the same structure as Document

targetIds

Array of number

 

A set of target IDs of targets that match this document.

removedTargetIds

Array of number

 

A set of target IDs for targets that no longer match this document.

See also

google.firestore.v1beta1.DocumentChange definition in proto format

static

DocumentDelete

A Document has been deleted.

May be the result of multiple writes, including updates, the last of which deleted the Document.

Multiple DocumentDelete messages may be returned for the same logical delete, if multiple targets are affected.

Properties

Name Type Optional Description

document

string

 

The resource name of the Document that was deleted.

removedTargetIds

Array of number

 

A set of target IDs for targets that previously matched this entity.

readTime

Object

 

The read timestamp at which the delete was observed.

Greater or equal to the commit_time of the delete.

This object should have the same structure as Timestamp

See also

google.firestore.v1beta1.DocumentDelete definition in proto format

static

DocumentMask

A set of field paths on a document. Used to restrict a get or update operation on a document to a subset of its fields. This is different from standard field masks, as this is always scoped to a Document, and takes in account the dynamic nature of Value.

Property

Name Type Optional Description

fieldPaths

Array of string

 

The list of field paths in the mask. See Document.fields for a field path syntax reference.

See also

google.firestore.v1beta1.DocumentMask definition in proto format

static

DocumentRemove

A Document has been removed from the view of the targets.

Sent if the document is no longer relevant to a target and is out of view. Can be sent instead of a DocumentDelete or a DocumentChange if the server can not send the new value of the document.

Multiple DocumentRemove messages may be returned for the same logical write or delete, if multiple targets are affected.

Properties

Name Type Optional Description

document

string

 

The resource name of the Document that has gone out of view.

removedTargetIds

Array of number

 

A set of target IDs for targets that previously matched this document.

readTime

Object

 

The read timestamp at which the remove was observed.

Greater or equal to the commit_time of the change/delete/remove.

This object should have the same structure as Timestamp

See also

google.firestore.v1beta1.DocumentRemove definition in proto format

static

DocumentsTarget

A target specified by a set of documents names.

Property

Name Type Optional Description

documents

Array of string

 

The names of the documents to retrieve. In the format: projects/{project_id}/databases/{database_id}/documents/{document_path}. The request will fail if any of the document is not a child resource of the given database. Duplicate names will be elided.

See also

google.firestore.v1beta1.Target.DocumentsTarget definition in proto format

static

DocumentTransform

A transformation of a document.

Properties

Name Type Optional Description

document

string

 

The name of the document to transform.

fieldTransforms

Array of Object

 

The list of transformations to apply to the fields of the document, in order. This must not be empty.

This object should have the same structure as FieldTransform

See also

google.firestore.v1beta1.DocumentTransform definition in proto format

static

ExistenceFilter

A digest of all the documents that match a given target.

Properties

Name Type Optional Description

targetId

number

 

The target ID to which this filter applies.

count

number

 

The total count of documents that match target_id.

If different from the count of documents in the client that match, the client must manually determine which documents no longer match the target.

See also

google.firestore.v1beta1.ExistenceFilter definition in proto format

static

FieldFilter

A filter on a specific field.

Properties

Name Type Optional Description

field

Object

 

The field to filter by.

This object should have the same structure as FieldReference

op

number

 

The operator to filter by.

The number should be among the values of Operator

value

Object

 

The value to compare to.

This object should have the same structure as Value

See also

google.firestore.v1beta1.StructuredQuery.FieldFilter definition in proto format

static

FieldReference

A reference to a field, such as max(messages.time) as max_time.

Property

Name Type Optional Description

fieldPath

string

 

See also

google.firestore.v1beta1.StructuredQuery.FieldReference definition in proto format

static

FieldTransform

A transformation of a field of the document.

Properties

Name Type Optional Description

fieldPath

string

 

The path of the field. See Document.fields for the field path syntax reference.

setToServerValue

number

 

Sets the field to the given server value.

The number should be among the values of ServerValue

increment

Object

 

Adds the given value to the field's current value.

This must be an integer or a double value. If the field is not an integer or double, or if the field does not yet exist, the transformation will set the field to the given value. If either of the given value or the current field value are doubles, both values will be interpreted as doubles. Double arithmetic and representation of double values follow IEEE 754 semantics. If there is positive/negative integer overflow, the field is resolved to the largest magnitude positive/negative integer.

This object should have the same structure as Value

maximum

Object

 

Sets the field to the maximum of its current value and the given value.

This must be an integer or a double value. If the field is not an integer or double, or if the field does not yet exist, the transformation will set the field to the given value. If a maximum operation is applied where the field and the input value are of mixed types (that is - one is an integer and one is a double) the field takes on the type of the larger operand. If the operands are equivalent (e.g. 3 and 3.0), the field does not change. 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value and zero input value is always the stored value. The maximum of any numeric value x and NaN is NaN.

This object should have the same structure as Value

minimum

Object

 

Sets the field to the minimum of its current value and the given value.

This must be an integer or a double value. If the field is not an integer or double, or if the field does not yet exist, the transformation will set the field to the input value. If a minimum operation is applied where the field and the input value are of mixed types (that is - one is an integer and one is a double) the field takes on the type of the smaller operand. If the operands are equivalent (e.g. 3 and 3.0), the field does not change. 0, 0.0, and -0.0 are all zero. The minimum of a zero stored value and zero input value is always the stored value. The minimum of any numeric value x and NaN is NaN.

This object should have the same structure as Value

appendMissingElements

Object

 

Append the given elements in order if they are not already present in the current field value. If the field is not an array, or if the field does not yet exist, it is first set to the empty array.

Equivalent numbers of different types (e.g. 3L and 3.0) are considered equal when checking if a value is missing. NaN is equal to NaN, and Null is equal to Null. If the input contains multiple equivalent values, only the first will be considered.

The corresponding transform_result will be the null value.

This object should have the same structure as ArrayValue

removeAllFromArray

Object

 

Remove all of the given elements from the array in the field. If the field is not an array, or if the field does not yet exist, it is set to the empty array.

Equivalent numbers of the different types (e.g. 3L and 3.0) are considered equal when deciding whether an element should be removed. NaN is equal to NaN, and Null is equal to Null. This will remove all equivalent values if there are duplicates.

The corresponding transform_result will be the null value.

This object should have the same structure as ArrayValue

See also

google.firestore.v1beta1.DocumentTransform.FieldTransform definition in proto format

static

Filter

A filter.

Properties

Name Type Optional Description

compositeFilter

Object

 

A composite filter.

This object should have the same structure as CompositeFilter

fieldFilter

Object

 

A filter on a document field.

This object should have the same structure as FieldFilter

unaryFilter

Object

 

A filter that takes exactly one argument.

This object should have the same structure as UnaryFilter

See also

google.firestore.v1beta1.StructuredQuery.Filter definition in proto format

static

GetDocumentRequest

The request for Firestore.GetDocument.

Properties

Name Type Optional Description

name

string

 

The resource name of the Document to get. In the format: projects/{project_id}/databases/{database_id}/documents/{document_path}.

mask

Object

 

The fields to return. If not set, returns all fields.

If the document has a field that is not present in this mask, that field will not be returned in the response.

This object should have the same structure as DocumentMask

transaction

string

 

Reads the document in a transaction.

readTime

Object

 

Reads the version of the document at the given time. This may not be older than 60 seconds.

This object should have the same structure as Timestamp

See also

google.firestore.v1beta1.GetDocumentRequest definition in proto format

static

ListCollectionIdsRequest

The request for Firestore.ListCollectionIds.

Properties

Name Type Optional Description

parent

string

 

The parent document. In the format: projects/{project_id}/databases/{database_id}/documents/{document_path}. For example: projects/my-project/databases/my-database/documents/chatrooms/my-chatroom

pageSize

number

 

The maximum number of results to return.

pageToken

string

 

A page token. Must be a value from ListCollectionIdsResponse.

See also

google.firestore.v1beta1.ListCollectionIdsRequest definition in proto format

static

ListCollectionIdsResponse

The response from Firestore.ListCollectionIds.

Properties

Name Type Optional Description

collectionIds

Array of string

 

The collection ids.

nextPageToken

string

 

A page token that may be used to continue the list.

See also

google.firestore.v1beta1.ListCollectionIdsResponse definition in proto format

static

ListDocumentsRequest

The request for Firestore.ListDocuments.

Properties

Name Type Optional Description

parent

string

 

The parent resource name. In the format: projects/{project_id}/databases/{database_id}/documents or projects/{project_id}/databases/{database_id}/documents/{document_path}. For example: projects/my-project/databases/my-database/documents or projects/my-project/databases/my-database/documents/chatrooms/my-chatroom

collectionId

string

 

The collection ID, relative to parent, to list. For example: chatrooms or messages.

pageSize

number

 

The maximum number of documents to return.

pageToken

string

 

The next_page_token value returned from a previous List request, if any.

orderBy

string

 

The order to sort results by. For example: priority desc, name.

mask

Object

 

The fields to return. If not set, returns all fields.

If a document has a field that is not present in this mask, that field will not be returned in the response.

This object should have the same structure as DocumentMask

transaction

string

 

Reads documents in a transaction.

readTime

Object

 

Reads documents as they were at the given time. This may not be older than 60 seconds.

This object should have the same structure as Timestamp

showMissing

boolean

 

If the list should show missing documents. A missing document is a document that does not exist but has sub-documents. These documents will be returned with a key but will not have fields, Document.create_time, or Document.update_time set.

Requests with show_missing may not specify where or order_by.

See also

google.firestore.v1beta1.ListDocumentsRequest definition in proto format

static

ListDocumentsResponse

The response for Firestore.ListDocuments.

Properties

Name Type Optional Description

documents

Array of Object

 

The Documents found.

This object should have the same structure as Document

nextPageToken

string

 

The next page token.

See also

google.firestore.v1beta1.ListDocumentsResponse definition in proto format

static

ListenRequest

A request for Firestore.Listen

Properties

Name Type Optional Description

database

string

 

The database name. In the format: projects/{project_id}/databases/{database_id}.

addTarget

Object

 

A target to add to this stream.

This object should have the same structure as Target

removeTarget

number

 

The ID of a target to remove from this stream.

labels

Object with string properties

 

Labels associated with this target change.

See also

google.firestore.v1beta1.ListenRequest definition in proto format

static

ListenResponse

The response for Firestore.Listen.

Properties

Name Type Optional Description

targetChange

Object

 

Targets have changed.

This object should have the same structure as TargetChange

documentChange

Object

 

A Document has changed.

This object should have the same structure as DocumentChange

documentDelete

Object

 

A Document has been deleted.

This object should have the same structure as DocumentDelete

documentRemove

Object

 

A Document has been removed from a target (because it is no longer relevant to that target).

This object should have the same structure as DocumentRemove

filter

Object

 

A filter to apply to the set of documents previously returned for the given target.

Returned when documents may have been removed from the given target, but the exact documents are unknown.

This object should have the same structure as ExistenceFilter

See also

google.firestore.v1beta1.ListenResponse definition in proto format

static

MapValue

A map value.

Property

Name Type Optional Description

fields

Object with Object properties

 

The map's fields.

The map keys represent field names. Field names matching the regular expression __.*__ are reserved. Reserved field names are forbidden except in certain documented contexts. The map keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be empty.

See also

google.firestore.v1beta1.MapValue definition in proto format

static

Order

An order on a field.

Properties

Name Type Optional Description

field

Object

 

The field to order by.

This object should have the same structure as FieldReference

direction

number

 

The direction to order by. Defaults to ASCENDING.

The number should be among the values of Direction

See also

google.firestore.v1beta1.StructuredQuery.Order definition in proto format

static

Precondition

A precondition on a document, used for conditional operations.

Properties

Name Type Optional Description

exists

boolean

 

When set to true, the target document must exist. When set to false, the target document must not exist.

updateTime

Object

 

When set, the target document must exist and have been last updated at that time.

This object should have the same structure as Timestamp

See also

google.firestore.v1beta1.Precondition definition in proto format

static

Projection

The projection of document's fields to return.

Property

Name Type Optional Description

fields

Array of Object

 

The fields to return.

If empty, all fields are returned. To only return the name of the document, use ['__name__'].

This object should have the same structure as FieldReference

See also

google.firestore.v1beta1.StructuredQuery.Projection definition in proto format

static

QueryTarget

A target specified by a query.

Properties

Name Type Optional Description

parent

string

 

The parent resource name. In the format: projects/{project_id}/databases/{database_id}/documents or projects/{project_id}/databases/{database_id}/documents/{document_path}. For example: projects/my-project/databases/my-database/documents or projects/my-project/databases/my-database/documents/chatrooms/my-chatroom

structuredQuery

Object

 

A structured query.

This object should have the same structure as StructuredQuery

See also

google.firestore.v1beta1.Target.QueryTarget definition in proto format

static

ReadOnly

Options for a transaction that can only be used to read documents.

Property

Name Type Optional Description

readTime

Object

 

Reads documents at the given time. This may not be older than 60 seconds.

This object should have the same structure as Timestamp

See also

google.firestore.v1beta1.TransactionOptions.ReadOnly definition in proto format

static

ReadWrite

Options for a transaction that can be used to read and write documents.

Property

Name Type Optional Description

retryTransaction

string

 

An optional transaction to retry.

See also

google.firestore.v1beta1.TransactionOptions.ReadWrite definition in proto format

static

RollbackRequest

The request for Firestore.Rollback.

Properties

Name Type Optional Description

database

string

 

The database name. In the format: projects/{project_id}/databases/{database_id}.

transaction

string

 

The transaction to roll back.

See also

google.firestore.v1beta1.RollbackRequest definition in proto format

static

RunQueryRequest

The request for Firestore.RunQuery.

Properties

Name Type Optional Description

parent

string

 

The parent resource name. In the format: projects/{project_id}/databases/{database_id}/documents or projects/{project_id}/databases/{database_id}/documents/{document_path}. For example: projects/my-project/databases/my-database/documents or projects/my-project/databases/my-database/documents/chatrooms/my-chatroom

structuredQuery

Object

 

A structured query.

This object should have the same structure as StructuredQuery

transaction

string

 

Reads documents in a transaction.

newTransaction

Object

 

Starts a new transaction and reads the documents. Defaults to a read-only transaction. The new transaction ID will be returned as the first response in the stream.

This object should have the same structure as TransactionOptions

readTime

Object

 

Reads documents as they were at the given time. This may not be older than 60 seconds.

This object should have the same structure as Timestamp

See also

google.firestore.v1beta1.RunQueryRequest definition in proto format

static

RunQueryResponse

The response for Firestore.RunQuery.

Properties

Name Type Optional Description

transaction

string

 

The transaction that was started as part of this request. Can only be set in the first response, and only if RunQueryRequest.new_transaction was set in the request. If set, no other fields will be set in this response.

document

Object

 

A query result. Not set when reporting partial progress.

This object should have the same structure as Document

readTime

Object

 

The time at which the document was read. This may be monotonically increasing; in this case, the previous documents in the result stream are guaranteed not to have changed between their read_time and this one.

If the query returns no results, a response with read_time and no document will be sent, and this represents the time at which the query was run.

This object should have the same structure as Timestamp

skippedResults

number

 

The number of results that have been skipped due to an offset between the last response and the current response.

See also

google.firestore.v1beta1.RunQueryResponse definition in proto format

static

StructuredQuery

A Firestore query.

Properties

Name Type Optional Description

select

Object

 

The projection to return.

This object should have the same structure as Projection

from

Array of Object

 

The collections to query.

This object should have the same structure as CollectionSelector

where

Object

 

The filter to apply.

This object should have the same structure as Filter

orderBy

Array of Object

 

The order to apply to the query results.

Firestore guarantees a stable ordering through the following rules:

  • Any field required to appear in order_by, that is not already specified in order_by, is appended to the order in field name order by default.
  • If an order on __name__ is not specified, it is appended by default.

Fields are appended with the same sort direction as the last order specified, or 'ASCENDING' if no order was specified. For example:

  • SELECT * FROM Foo ORDER BY A becomes SELECT * FROM Foo ORDER BY A, __name__
  • SELECT * FROM Foo ORDER BY A DESC becomes SELECT * FROM Foo ORDER BY A DESC, __name__ DESC
  • SELECT * FROM Foo WHERE A > 1 becomes SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__

This object should have the same structure as Order

startAt

Object

 

A starting point for the query results.

This object should have the same structure as Cursor

endAt

Object

 

A end point for the query results.

This object should have the same structure as Cursor

offset

number

 

The number of results to skip.

Applies before limit, but after all other constraints. Must be >= 0 if specified.

limit

Object

 

The maximum number of results to return.

Applies after all other constraints. Must be >= 0 if specified.

This object should have the same structure as Int32Value

See also

google.firestore.v1beta1.StructuredQuery definition in proto format

static

Target

A specification of a set of documents to listen to.

Properties

Name Type Optional Description

query

Object

 

A target specified by a query.

This object should have the same structure as QueryTarget

documents

Object

 

A target specified by a set of document names.

This object should have the same structure as DocumentsTarget

resumeToken

string

 

A resume token from a prior TargetChange for an identical target.

Using a resume token with a different target is unsupported and may fail.

readTime

Object

 

Start listening after a specific read_time.

The client must know the state of matching documents at this time.

This object should have the same structure as Timestamp

targetId

number

 

A client provided target ID.

If not set, the server will assign an ID for the target.

Used for resuming a target without changing IDs. The IDs can either be client-assigned or be server-assigned in a previous stream. All targets with client provided IDs must be added before adding a target that needs a server-assigned id.

once

boolean

 

If the target should be removed once it is current and consistent.

See also

google.firestore.v1beta1.Target definition in proto format

static

TargetChange

Targets being watched have changed.

Properties

Name Type Optional Description

targetChangeType

number

 

The type of change that occurred.

The number should be among the values of TargetChangeType

targetIds

Array of number

 

The target IDs of targets that have changed.

If empty, the change applies to all targets.

For target_change_type=ADD, the order of the target IDs matches the order of the requests to add the targets. This allows clients to unambiguously associate server-assigned target IDs with added targets.

For other states, the order of the target IDs is not defined.

cause

Object

 

The error that resulted in this change, if applicable.

This object should have the same structure as Status

resumeToken

string

 

A token that can be used to resume the stream for the given target_ids, or all targets if target_ids is empty.

Not set on every target change.

readTime

Object

 

The consistent read_time for the given target_ids (omitted when the target_ids are not at a consistent snapshot).

The stream is guaranteed to send a read_time with target_ids empty whenever the entire stream reaches a new consistent snapshot. ADD, CURRENT, and RESET messages are guaranteed to (eventually) result in a new consistent snapshot (while NO_CHANGE and REMOVE messages are not).

For a given stream, read_time is guaranteed to be monotonically increasing.

This object should have the same structure as Timestamp

See also

google.firestore.v1beta1.TargetChange definition in proto format

static

TransactionOptions

Options for creating a new transaction.

Properties

Name Type Optional Description

readOnly

Object

 

The transaction can only be used for read operations.

This object should have the same structure as ReadOnly

readWrite

Object

 

The transaction can be used for both read and write operations.

This object should have the same structure as ReadWrite

See also

google.firestore.v1beta1.TransactionOptions definition in proto format

static

UnaryFilter

A filter with a single operand.

Properties

Name Type Optional Description

op

number

 

The unary operator to apply.

The number should be among the values of Operator

field

Object

 

The field to which to apply the operator.

This object should have the same structure as FieldReference

See also

google.firestore.v1beta1.StructuredQuery.UnaryFilter definition in proto format

static

UpdateDocumentRequest

The request for Firestore.UpdateDocument.

Properties

Name Type Optional Description

document

Object

 

The updated document. Creates the document if it does not already exist.

This object should have the same structure as Document

updateMask

Object

 

The fields to update. None of the field paths in the mask may contain a reserved name.

If the document exists on the server and has fields not referenced in the mask, they are left unchanged. Fields referenced in the mask, but not present in the input document, are deleted from the document on the server.

This object should have the same structure as DocumentMask

mask

Object

 

The fields to return. If not set, returns all fields.

If the document has a field that is not present in this mask, that field will not be returned in the response.

This object should have the same structure as DocumentMask

currentDocument

Object

 

An optional precondition on the document. The request will fail if this is set and not met by the target document.

This object should have the same structure as Precondition

See also

google.firestore.v1beta1.UpdateDocumentRequest definition in proto format

static

Value

A message that can hold any of the supported value types.

Properties

Name Type Optional Description

nullValue

number

 

A null value.

The number should be among the values of NullValue

booleanValue

boolean

 

A boolean value.

integerValue

number

 

An integer value.

doubleValue

number

 

A double value.

timestampValue

Object

 

A timestamp value.

Precise only to microseconds. When stored, any additional precision is rounded down.

This object should have the same structure as Timestamp

stringValue

string

 

A string value.

The string, represented as UTF-8, must not exceed 1 MiB - 89 bytes. Only the first 1,500 bytes of the UTF-8 representation are considered by queries.

bytesValue

string

 

A bytes value.

Must not exceed 1 MiB - 89 bytes. Only the first 1,500 bytes are considered by queries.

referenceValue

string

 

A reference to a document. For example: projects/{project_id}/databases/{database_id}/documents/{document_path}.

geoPointValue

Object

 

A geo point value representing a point on the surface of Earth.

This object should have the same structure as LatLng

arrayValue

Object

 

An array value.

Cannot directly contain another array value, though can contain an map which contains another array.

This object should have the same structure as ArrayValue

mapValue

Object

 

A map value.

This object should have the same structure as MapValue

See also

google.firestore.v1beta1.Value definition in proto format

static

Write

A write on a document.

Properties

Name Type Optional Description

update

Object

 

A document to write.

This object should have the same structure as Document

delete

string

 

A document name to delete. In the format: projects/{project_id}/databases/{database_id}/documents/{document_path}.

transform

Object

 

Applies a transformation to a document. At most one transform per document is allowed in a given request. An update cannot follow a transform on the same document in a given request.

This object should have the same structure as DocumentTransform

updateMask

Object

 

The fields to update in this write.

This field can be set only when the operation is update. If the mask is not set for an update and the document exists, any existing data will be overwritten. If the mask is set and the document on the server has fields not covered by the mask, they are left unchanged. Fields referenced in the mask, but not present in the input document, are deleted from the document on the server. The field paths in this mask must not contain a reserved field name.

This object should have the same structure as DocumentMask

currentDocument

Object

 

An optional precondition on the document.

The write will fail if this is set and not met by the target document.

This object should have the same structure as Precondition

See also

google.firestore.v1beta1.Write definition in proto format

static

WriteRequest

The request for Firestore.Write.

The first request creates a stream, or resumes an existing one from a token.

When creating a new stream, the server replies with a response containing only an ID and a token, to use in the next request.

When resuming a stream, the server first streams any responses later than the given token, then a response containing only an up-to-date token, to use in the next request.

Properties

Name Type Optional Description

database

string

 

The database name. In the format: projects/{project_id}/databases/{database_id}. This is only required in the first message.

streamId

string

 

The ID of the write stream to resume. This may only be set in the first message. When left empty, a new write stream will be created.

writes

Array of Object

 

The writes to apply.

Always executed atomically and in order. This must be empty on the first request. This may be empty on the last request. This must not be empty on all other requests.

This object should have the same structure as Write

streamToken

string

 

A stream token that was previously sent by the server.

The client should set this field to the token from the most recent WriteResponse it has received. This acknowledges that the client has received responses up to this token. After sending this token, earlier tokens may not be used anymore.

The server may close the stream if there are too many unacknowledged responses.

Leave this field unset when creating a new stream. To resume a stream at a specific point, set this field and the stream_id field.

Leave this field unset when creating a new stream.

labels

Object with string properties

 

Labels associated with this write request.

See also

google.firestore.v1beta1.WriteRequest definition in proto format

static

WriteResponse

The response for Firestore.Write.

Properties

Name Type Optional Description

streamId

string

 

The ID of the stream. Only set on the first message, when a new stream was created.

streamToken

string

 

A token that represents the position of this response in the stream. This can be used by a client to resume the stream at this point.

This field is always set.

writeResults

Array of Object

 

The result of applying the writes.

This i-th write result corresponds to the i-th write in the request.

This object should have the same structure as WriteResult

commitTime

Object

 

The time at which the commit occurred.

This object should have the same structure as Timestamp

See also

google.firestore.v1beta1.WriteResponse definition in proto format

static

WriteResult

The result of applying a write.

Properties

Name Type Optional Description

updateTime

Object

 

The last update time of the document after applying the write. Not set after a delete.

If the write did not actually change the document, this will be the previous update_time.

This object should have the same structure as Timestamp

transformResults

Array of Object

 

The results of applying each DocumentTransform.FieldTransform, in the same order.

This object should have the same structure as Value

See also

google.firestore.v1beta1.WriteResult definition in proto format