Stay organized with collections Save and categorize content based on your preferences.

Types

class google.cloud.firestore_v1.types.ArrayValue(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

An array value.

values()

Values in the array.

  • Type

    Sequence[google.cloud.firestore_v1.types.Value]

class google.cloud.firestore_v1.types.BatchGetDocumentsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The request for [Firestore.BatchGetDocuments][google.firestore.v1.Firestore.BatchGetDocuments].

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

database()

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

documents()

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.

  • Type

    Sequence[str]

mask()

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.

  • Type

    google.cloud.firestore_v1.types.DocumentMask

transaction()

Reads documents in a transaction.

This field is a member of oneof consistency_selector.

new_transaction()

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 field is a member of oneof consistency_selector.

  • Type

    google.cloud.firestore_v1.types.TransactionOptions

read_time()

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

This field is a member of oneof consistency_selector.

class google.cloud.firestore_v1.types.BatchGetDocumentsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The streamed response for [Firestore.BatchGetDocuments][google.firestore.v1.Firestore.BatchGetDocuments].

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

found()

A document that was requested.

This field is a member of oneof result.

  • Type

    google.cloud.firestore_v1.types.Document

missing()

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

This field is a member of oneof result.

transaction()

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

read_time()

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.

class google.cloud.firestore_v1.types.BatchWriteRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The request for [Firestore.BatchWrite][google.firestore.v1.Firestore.BatchWrite].

database()

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

writes()

The writes to apply. Method does not apply writes atomically and does not guarantee ordering. Each write succeeds or fails independently. You cannot write to the same document more than once per request.

  • Type

    Sequence[google.cloud.firestore_v1.types.Write]

labels()

Labels associated with this batch write.

class LabelsEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class google.cloud.firestore_v1.types.BatchWriteResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The response from [Firestore.BatchWrite][google.firestore.v1.Firestore.BatchWrite].

write_results()

The result of applying the writes. This i-th write result corresponds to the i-th write in the request.

  • Type

    Sequence[google.cloud.firestore_v1.types.WriteResult]

status()

The status of applying the writes. This i-th write status corresponds to the i-th write in the request.

  • Type

    Sequence[google.rpc.status_pb2.Status]

class google.cloud.firestore_v1.types.BeginTransactionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The request for [Firestore.BeginTransaction][google.firestore.v1.Firestore.BeginTransaction].

database()

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

options()

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

  • Type

    google.cloud.firestore_v1.types.TransactionOptions

class google.cloud.firestore_v1.types.BeginTransactionResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The response for [Firestore.BeginTransaction][google.firestore.v1.Firestore.BeginTransaction].

transaction()

The transaction that was started.

class google.cloud.firestore_v1.types.CommitRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The request for [Firestore.Commit][google.firestore.v1.Firestore.Commit].

database()

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

writes()

The writes to apply. Always executed atomically and in order.

  • Type

    Sequence[google.cloud.firestore_v1.types.Write]

transaction()

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

class google.cloud.firestore_v1.types.CommitResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The response for [Firestore.Commit][google.firestore.v1.Firestore.Commit].

write_results()

The result of applying the writes. This i-th write result corresponds to the i-th write in the request.

  • Type

    Sequence[google.cloud.firestore_v1.types.WriteResult]

commit_time()

The time at which the commit occurred. Any read with an equal or greater read_time is guaranteed to see the effects of the commit.

class google.cloud.firestore_v1.types.CreateDocumentRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The request for [Firestore.CreateDocument][google.firestore.v1.Firestore.CreateDocument].

parent()

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

collection_id()

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

document_id()

The client-assigned document ID to use for this document. Optional. If not specified, an ID will be assigned by the service.

document()

Required. The document to create. name must not be set.

  • Type

    google.cloud.firestore_v1.types.Document

mask()

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.

  • Type

    google.cloud.firestore_v1.types.DocumentMask

class google.cloud.firestore_v1.types.Cursor(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A position in a query result set.

values()

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.

  • Type

    Sequence[google.cloud.firestore_v1.types.Value]

before()

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

class google.cloud.firestore_v1.types.DeleteDocumentRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The request for [Firestore.DeleteDocument][google.firestore.v1.Firestore.DeleteDocument].

name()

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

current_document()

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

  • Type

    google.cloud.firestore_v1.types.Precondition

class google.cloud.firestore_v1.types.Document(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A Firestore document. Must not exceed 1 MiB - 4 bytes.

name()

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

fields()

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`representsx&yand`bak`tik`representsbak`tik`.

  • Type

    Mapping[str, google.cloud.firestore_v1.types.Value]

create_time()

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.

update_time()

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.

class FieldsEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class google.cloud.firestore_v1.types.DocumentChange(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A [Document][google.firestore.v1.Document] has changed.

May be the result of multiple [writes][google.firestore.v1.Write], including deletes, that ultimately resulted in a new value for the [Document][google.firestore.v1.Document].

Multiple [DocumentChange][google.firestore.v1.DocumentChange] messages may be returned for the same logical change, if multiple targets are affected.

document()

The new state of the [Document][google.firestore.v1.Document].

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

  • Type

    google.cloud.firestore_v1.types.Document

target_ids()

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

  • Type

    Sequence[int]

removed_target_ids()

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

  • Type

    Sequence[int]

class google.cloud.firestore_v1.types.DocumentDelete(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A [Document][google.firestore.v1.Document] has been deleted.

May be the result of multiple [writes][google.firestore.v1.Write], including updates, the last of which deleted the [Document][google.firestore.v1.Document].

Multiple [DocumentDelete][google.firestore.v1.DocumentDelete] messages may be returned for the same logical delete, if multiple targets are affected.

document()

The resource name of the [Document][google.firestore.v1.Document] that was deleted.

removed_target_ids()

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

  • Type

    Sequence[int]

read_time()

The read timestamp at which the delete was observed.

Greater or equal to the commit_time of the delete.

class google.cloud.firestore_v1.types.DocumentMask(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

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][google.firestore.v1.Document], and takes in account the dynamic nature of [Value][google.firestore.v1.Value].

field_paths()

The list of field paths in the mask. See [Document.fields][google.firestore.v1.Document.fields] for a field path syntax reference.

  • Type

    Sequence[str]

class google.cloud.firestore_v1.types.DocumentRemove(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A [Document][google.firestore.v1.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][google.firestore.v1.DocumentRemove] messages may be returned for the same logical write or delete, if multiple targets are affected.

document()

The resource name of the [Document][google.firestore.v1.Document] that has gone out of view.

removed_target_ids()

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

  • Type

    Sequence[int]

read_time()

The read timestamp at which the remove was observed.

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

class google.cloud.firestore_v1.types.DocumentTransform(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A transformation of a document.

document()

The name of the document to transform.

field_transforms()

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

  • Type

    Sequence[google.cloud.firestore_v1.types.DocumentTransform.FieldTransform]

class FieldTransform(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A transformation of a field of the document.

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

field_path()

The path of the field. See [Document.fields][google.firestore.v1.Document.fields] for the field path syntax reference.

set_to_server_value()

Sets the field to the given server value.

This field is a member of oneof transform_type.

  • Type

    google.cloud.firestore_v1.types.DocumentTransform.FieldTransform.ServerValue

increment()

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 field is a member of oneof transform_type.

  • Type

    google.cloud.firestore_v1.types.Value

maximum()

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 field is a member of oneof transform_type.

  • Type

    google.cloud.firestore_v1.types.Value

minimum()

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 field is a member of oneof transform_type.

  • Type

    google.cloud.firestore_v1.types.Value

append_missing_elements()

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 field is a member of oneof transform_type.

  • Type

    google.cloud.firestore_v1.types.ArrayValue

remove_all_from_array()

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 field is a member of oneof transform_type.

  • Type

    google.cloud.firestore_v1.types.ArrayValue

class ServerValue(value)

Bases: proto.enums.Enum

A value that is calculated by the server.

class google.cloud.firestore_v1.types.ExistenceFilter(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

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

target_id()

The target ID to which this filter applies.

count()

The total count of documents that match [target_id][google.firestore.v1.ExistenceFilter.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.

class google.cloud.firestore_v1.types.GetDocumentRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The request for [Firestore.GetDocument][google.firestore.v1.Firestore.GetDocument].

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

name()

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

mask()

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.

  • Type

    google.cloud.firestore_v1.types.DocumentMask

transaction()

Reads the document in a transaction.

This field is a member of oneof consistency_selector.

read_time()

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

This field is a member of oneof consistency_selector.

class google.cloud.firestore_v1.types.ListCollectionIdsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The request for [Firestore.ListCollectionIds][google.firestore.v1.Firestore.ListCollectionIds].

parent()

Required. 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

page_size()

The maximum number of results to return.

page_token()

A page token. Must be a value from [ListCollectionIdsResponse][google.firestore.v1.ListCollectionIdsResponse].

read_time()

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

This field is a member of oneof consistency_selector.

class google.cloud.firestore_v1.types.ListCollectionIdsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The response from [Firestore.ListCollectionIds][google.firestore.v1.Firestore.ListCollectionIds].

collection_ids()

The collection ids.

  • Type

    Sequence[str]

next_page_token()

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

class google.cloud.firestore_v1.types.ListDocumentsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The request for [Firestore.ListDocuments][google.firestore.v1.Firestore.ListDocuments].

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

parent()

Required. 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

collection_id()

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

page_size()

The maximum number of documents to return.

page_token()

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

order_by()

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

mask()

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.

  • Type

    google.cloud.firestore_v1.types.DocumentMask

transaction()

Reads documents in a transaction.

This field is a member of oneof consistency_selector.

read_time()

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

This field is a member of oneof consistency_selector.

show_missing()

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][google.firestore.v1.Document.create_time], or [Document.update_time][google.firestore.v1.Document.update_time] set.

Requests with show_missing may not specify where or order_by.

class google.cloud.firestore_v1.types.ListDocumentsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The response for [Firestore.ListDocuments][google.firestore.v1.Firestore.ListDocuments].

documents()

The Documents found.

  • Type

    Sequence[google.cloud.firestore_v1.types.Document]

next_page_token()

The next page token.

class google.cloud.firestore_v1.types.ListenRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A request for [Firestore.Listen][google.firestore.v1.Firestore.Listen]

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

database()

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

add_target()

A target to add to this stream.

This field is a member of oneof target_change.

  • Type

    google.cloud.firestore_v1.types.Target

remove_target()

The ID of a target to remove from this stream.

This field is a member of oneof target_change.

labels()

Labels associated with this target change.

class LabelsEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class google.cloud.firestore_v1.types.ListenResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The response for [Firestore.Listen][google.firestore.v1.Firestore.Listen].

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

target_change()

Targets have changed.

This field is a member of oneof response_type.

  • Type

    google.cloud.firestore_v1.types.TargetChange

document_change()

A [Document][google.firestore.v1.Document] has changed.

This field is a member of oneof response_type.

  • Type

    google.cloud.firestore_v1.types.DocumentChange

document_delete()

A [Document][google.firestore.v1.Document] has been deleted.

This field is a member of oneof response_type.

  • Type

    google.cloud.firestore_v1.types.DocumentDelete

document_remove()

A [Document][google.firestore.v1.Document] has been removed from a target (because it is no longer relevant to that target).

This field is a member of oneof response_type.

  • Type

    google.cloud.firestore_v1.types.DocumentRemove

filter()

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 field is a member of oneof response_type.

  • Type

    google.cloud.firestore_v1.types.ExistenceFilter

class google.cloud.firestore_v1.types.MapValue(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A map value.

fields()

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.

  • Type

    Mapping[str, google.cloud.firestore_v1.types.Value]

class FieldsEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class google.cloud.firestore_v1.types.PartitionQueryRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The request for [Firestore.PartitionQuery][google.firestore.v1.Firestore.PartitionQuery].

parent()

Required. The parent resource name. In the format: projects/{project_id}/databases/{database_id}/documents. Document resource names are not supported; only database resource names can be specified.

structured_query()

A structured query. Query must specify collection with all descendants and be ordered by name ascending. Other filters, order bys, limits, offsets, and start/end cursors are not supported.

This field is a member of oneof query_type.

  • Type

    google.cloud.firestore_v1.types.StructuredQuery

partition_count()

The desired maximum number of partition points. The partitions may be returned across multiple pages of results. The number must be positive. The actual number of partitions returned may be fewer.

For example, this may be set to one fewer than the number of parallel queries to be run, or in running a data pipeline job, one fewer than the number of workers or compute instances available.

page_token()

The next_page_token value returned from a previous call to PartitionQuery that may be used to get an additional set of results. There are no ordering guarantees between sets of results. Thus, using multiple sets of results will require merging the different result sets.

For example, two subsequent calls using a page_token may return:

  • cursor B, cursor M, cursor Q

  • cursor A, cursor U, cursor W

To obtain a complete result set ordered with respect to the results of the query supplied to PartitionQuery, the results sets should be merged: cursor A, cursor B, cursor M, cursor Q, cursor U, cursor W

page_size()

The maximum number of partitions to return in this call, subject to partition_count.

For example, if partition_count = 10 and page_size = 8, the first call to PartitionQuery will return up to 8 partitions and a next_page_token if more results exist. A second call to PartitionQuery will return up to 2 partitions, to complete the total of 10 specified in partition_count.

read_time()

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

This field is a member of oneof consistency_selector.

class google.cloud.firestore_v1.types.PartitionQueryResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The response for [Firestore.PartitionQuery][google.firestore.v1.Firestore.PartitionQuery].

partitions()

Partition results. Each partition is a split point that can be used by RunQuery as a starting or end point for the query results. The RunQuery requests must be made with the same query supplied to this PartitionQuery request. The partition cursors will be ordered according to same ordering as the results of the query supplied to PartitionQuery.

For example, if a PartitionQuery request returns partition cursors A and B, running the following three queries will return the entire result set of the original query:

  • query, end_at A

  • query, start_at A, end_at B

  • query, start_at B

An empty result may indicate that the query has too few results to be partitioned.

  • Type

    Sequence[google.cloud.firestore_v1.types.Cursor]

next_page_token()

A page token that may be used to request an additional set of results, up to the number specified by partition_count in the PartitionQuery request. If blank, there are no more results.

class google.cloud.firestore_v1.types.Precondition(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A precondition on a document, used for conditional operations.

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

exists()

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

This field is a member of oneof condition_type.

update_time()

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

This field is a member of oneof condition_type.

class google.cloud.firestore_v1.types.RollbackRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The request for [Firestore.Rollback][google.firestore.v1.Firestore.Rollback].

database()

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

transaction()

Required. The transaction to roll back.

class google.cloud.firestore_v1.types.RunQueryRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The request for [Firestore.RunQuery][google.firestore.v1.Firestore.RunQuery].

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

parent()

Required. 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

structured_query()

A structured query.

This field is a member of oneof query_type.

  • Type

    google.cloud.firestore_v1.types.StructuredQuery

transaction()

Run the query within an already active transaction. The value here is the opaque transaction ID to execute the query in.

This field is a member of oneof consistency_selector.

new_transaction()

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 field is a member of oneof consistency_selector.

  • Type

    google.cloud.firestore_v1.types.TransactionOptions

read_time()

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

This field is a member of oneof consistency_selector.

class google.cloud.firestore_v1.types.RunQueryResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The response for [Firestore.RunQuery][google.firestore.v1.Firestore.RunQuery].

transaction()

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

document()

A query result, not set when reporting partial progress.

  • Type

    google.cloud.firestore_v1.types.Document

read_time()

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.

skipped_results()

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

done()

If present, Firestore has completely finished the request and no more documents will be returned.

This field is a member of oneof continuation_selector.

class google.cloud.firestore_v1.types.StructuredQuery(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A Firestore query.

select()

The projection to return.

  • Type

    google.cloud.firestore_v1.types.StructuredQuery.Projection

from_()

The collections to query.

  • Type

    Sequence[google.cloud.firestore_v1.types.StructuredQuery.CollectionSelector]

where()

The filter to apply.

  • Type

    google.cloud.firestore_v1.types.StructuredQuery.Filter

order_by()

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__

  • Type

    Sequence[google.cloud.firestore_v1.types.StructuredQuery.Order]

start_at()

A starting point for the query results.

  • Type

    google.cloud.firestore_v1.types.Cursor

end_at()

A end point for the query results.

  • Type

    google.cloud.firestore_v1.types.Cursor

offset()

The number of results to skip. Applies before limit, but after all other constraints. Must be >= 0 if specified.

limit()

The maximum number of results to return. Applies after all other constraints. Must be >= 0 if specified.

class CollectionSelector(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

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

collection_id()

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

all_descendants()

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

class CompositeFilter(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

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

op()

The operator for combining multiple filters.

  • Type

    google.cloud.firestore_v1.types.StructuredQuery.CompositeFilter.Operator

filters()

The list of filters to combine.

Requires:

  • At least one filter is present.

  • Type

    Sequence[google.cloud.firestore_v1.types.StructuredQuery.Filter]

class Operator(value)

Bases: proto.enums.Enum

A composite filter operator.

class Direction(value)

Bases: proto.enums.Enum

A sort direction.

class FieldFilter(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A filter on a specific field.

field()

The field to filter by.

  • Type

    google.cloud.firestore_v1.types.StructuredQuery.FieldReference

op()

The operator to filter by.

  • Type

    google.cloud.firestore_v1.types.StructuredQuery.FieldFilter.Operator

value()

The value to compare to.

  • Type

    google.cloud.firestore_v1.types.Value

class Operator(value)

Bases: proto.enums.Enum

A field filter operator.

class FieldReference(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

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

field_path()

class Filter(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A filter.

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

composite_filter()

A composite filter.

This field is a member of oneof filter_type.

  • Type

    google.cloud.firestore_v1.types.StructuredQuery.CompositeFilter

field_filter()

A filter on a document field.

This field is a member of oneof filter_type.

  • Type

    google.cloud.firestore_v1.types.StructuredQuery.FieldFilter

unary_filter()

A filter that takes exactly one argument.

This field is a member of oneof filter_type.

  • Type

    google.cloud.firestore_v1.types.StructuredQuery.UnaryFilter

class Order(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

An order on a field.

field()

The field to order by.

  • Type

    google.cloud.firestore_v1.types.StructuredQuery.FieldReference

direction()

The direction to order by. Defaults to ASCENDING.

  • Type

    google.cloud.firestore_v1.types.StructuredQuery.Direction

class Projection(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The projection of document’s fields to return.

fields()

The fields to return.

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

  • Type

    Sequence[google.cloud.firestore_v1.types.StructuredQuery.FieldReference]

class UnaryFilter(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A filter with a single operand.

op()

The unary operator to apply.

  • Type

    google.cloud.firestore_v1.types.StructuredQuery.UnaryFilter.Operator

field()

The field to which to apply the operator.

This field is a member of oneof operand_type.

  • Type

    google.cloud.firestore_v1.types.StructuredQuery.FieldReference

class Operator(value)

Bases: proto.enums.Enum

A unary operator.

class google.cloud.firestore_v1.types.Target(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A specification of a set of documents to listen to.

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

query()

A target specified by a query.

This field is a member of oneof target_type.

  • Type

    google.cloud.firestore_v1.types.Target.QueryTarget

documents()

A target specified by a set of document names.

This field is a member of oneof target_type.

  • Type

    google.cloud.firestore_v1.types.Target.DocumentsTarget

resume_token()

A resume token from a prior [TargetChange][google.firestore.v1.TargetChange] for an identical target.

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

This field is a member of oneof resume_type.

read_time()

Start listening after a specific read_time.

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

This field is a member of oneof resume_type.

target_id()

The target ID that identifies the target on the stream. Must be a positive number and non-zero.

once()

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

class DocumentsTarget(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A target specified by a set of documents names.

documents()

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.

  • Type

    Sequence[str]

class QueryTarget(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A target specified by a query.

parent()

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

structured_query()

A structured query.

This field is a member of oneof query_type.

  • Type

    google.cloud.firestore_v1.types.StructuredQuery

class google.cloud.firestore_v1.types.TargetChange(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

Targets being watched have changed.

target_change_type()

The type of change that occurred.

  • Type

    google.cloud.firestore_v1.types.TargetChange.TargetChangeType

target_ids()

The target IDs of targets that have changed. If empty, the change applies to all targets.

The order of the target IDs is not defined.

  • Type

    Sequence[int]

cause()

The error that resulted in this change, if applicable.

  • Type

    google.rpc.status_pb2.Status

resume_token()

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.

read_time()

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.

class TargetChangeType(value)

Bases: proto.enums.Enum

The type of change.

class google.cloud.firestore_v1.types.TransactionOptions(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

Options for creating a new transaction.

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

read_only()

The transaction can only be used for read operations.

This field is a member of oneof mode.

  • Type

    google.cloud.firestore_v1.types.TransactionOptions.ReadOnly

read_write()

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

This field is a member of oneof mode.

  • Type

    google.cloud.firestore_v1.types.TransactionOptions.ReadWrite

class ReadOnly(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

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

read_time()

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

This field is a member of oneof consistency_selector.

class ReadWrite(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

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

retry_transaction()

An optional transaction to retry.

class google.cloud.firestore_v1.types.UpdateDocumentRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The request for [Firestore.UpdateDocument][google.firestore.v1.Firestore.UpdateDocument].

document()

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

  • Type

    google.cloud.firestore_v1.types.Document

update_mask()

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.

  • Type

    google.cloud.firestore_v1.types.DocumentMask

mask()

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.

  • Type

    google.cloud.firestore_v1.types.DocumentMask

current_document()

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

  • Type

    google.cloud.firestore_v1.types.Precondition

class google.cloud.firestore_v1.types.Value(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

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

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

null_value()

A null value.

This field is a member of oneof value_type.

  • Type

    google.protobuf.struct_pb2.NullValue

boolean_value()

A boolean value.

This field is a member of oneof value_type.

integer_value()

An integer value.

This field is a member of oneof value_type.

double_value()

A double value.

This field is a member of oneof value_type.

timestamp_value()

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

This field is a member of oneof value_type.

string_value()

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.

This field is a member of oneof value_type.

bytes_value()

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

This field is a member of oneof value_type.

reference_value()

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

This field is a member of oneof value_type.

geo_point_value()

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

This field is a member of oneof value_type.

  • Type

    google.type.latlng_pb2.LatLng

array_value()

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

This field is a member of oneof value_type.

  • Type

    google.cloud.firestore_v1.types.ArrayValue

map_value()

A map value.

This field is a member of oneof value_type.

  • Type

    google.cloud.firestore_v1.types.MapValue

class google.cloud.firestore_v1.types.Write(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

A write on a document.

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

update()

A document to write.

This field is a member of oneof operation.

  • Type

    google.cloud.firestore_v1.types.Document

delete()

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

This field is a member of oneof operation.

transform()

Applies a transformation to a document.

This field is a member of oneof operation.

  • Type

    google.cloud.firestore_v1.types.DocumentTransform

update_mask()

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.

  • Type

    google.cloud.firestore_v1.types.DocumentMask

update_transforms()

The transforms to perform after update.

This field can be set only when the operation is update. If present, this write is equivalent to performing update and transform to the same document atomically and in order.

  • Type

    Sequence[google.cloud.firestore_v1.types.DocumentTransform.FieldTransform]

current_document()

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

  • Type

    google.cloud.firestore_v1.types.Precondition

class google.cloud.firestore_v1.types.WriteRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The request for [Firestore.Write][google.firestore.v1.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.

database()

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

stream_id()

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()

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.

  • Type

    Sequence[google.cloud.firestore_v1.types.Write]

stream_token()

A stream token that was previously sent by the server.

The client should set this field to the token from the most recent [WriteResponse][google.firestore.v1.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()

Labels associated with this write request.

class LabelsEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class google.cloud.firestore_v1.types.WriteResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The response for [Firestore.Write][google.firestore.v1.Firestore.Write].

stream_id()

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

stream_token()

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.

write_results()

The result of applying the writes. This i-th write result corresponds to the i-th write in the request.

  • Type

    Sequence[google.cloud.firestore_v1.types.WriteResult]

commit_time()

The time at which the commit occurred. Any read with an equal or greater read_time is guaranteed to see the effects of the write.

class google.cloud.firestore_v1.types.WriteResult(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

The result of applying a write.

update_time()

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.

transform_results()

The results of applying each [DocumentTransform.FieldTransform][google.firestore.v1.DocumentTransform.FieldTransform], in the same order.

  • Type

    Sequence[google.cloud.firestore_v1.types.Value]