TransactionOptions
Stay organized with collections
Save and categorize content based on your preferences.
Options for creating a new transaction.
JSON representation |
{
// Union field mode can be only one of the following:
"readOnly": {
object (ReadOnly )
},
"readWrite": {
object (ReadWrite )
}
// End of list of possible types for union field mode .
} |
Fields |
Union field mode . The mode of the transaction. mode can be only one of the following: |
readOnly |
object (ReadOnly )
The transaction can only be used for read operations.
|
readWrite |
object (ReadWrite )
The transaction can be used for both read and write operations.
|
ReadOnly
Options for a transaction that can only be used to read documents.
JSON representation |
{
// Union field consistency_selector can be only one of the following:
"readTime": string
// End of list of possible types for union field consistency_selector .
} |
Fields |
Union field consistency_selector . The consistency mode for this transaction. If not set, defaults to strong consistency. consistency_selector can be only one of the following: |
readTime |
string (Timestamp format)
Reads documents at the given time. This must be a microsecond precision timestamp within the past one hour, or if Point-in-Time Recovery is enabled, can additionally be a whole minute timestamp within the past 7 days. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z" , "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30" .
|
ReadWrite
Options for a transaction that can be used to read and write documents.
Firestore does not allow 3rd party auth requests to create read-write. transactions.
JSON representation |
{
"retryTransaction": string
} |
Fields |
retryTransaction |
string (bytes format)
An optional transaction to retry. A base64-encoded string.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-26 UTC.
[null,null,["Last updated 2025-08-26 UTC."],[],[],null,["# TransactionOptions\n\nOptions for creating a new transaction.\n\n| JSON representation |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { // Union field `mode` can be only one of the following: \"readOnly\": { object (/docs/firestore/reference/rest/v1/TransactionOptions#ReadOnly) }, \"readWrite\": { object (/docs/firestore/reference/rest/v1/TransactionOptions#ReadWrite) } // End of list of possible types for union field `mode`. } ``` |\n\n| Fields ||\n|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Union field `mode`. The mode of the transaction. `mode` can be only one of the following: ||\n| `readOnly` | `object (`[ReadOnly](/docs/firestore/reference/rest/v1/TransactionOptions#ReadOnly)`)` The transaction can only be used for read operations. |\n| `readWrite` | `object (`[ReadWrite](/docs/firestore/reference/rest/v1/TransactionOptions#ReadWrite)`)` The transaction can be used for both read and write operations. |\n\nReadOnly\n--------\n\nOptions for a transaction that can only be used to read documents.\n\n| JSON representation |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { // Union field `consistency_selector` can be only one of the following: \"readTime\": string // End of list of possible types for union field `consistency_selector`. } ``` |\n\n| Fields ||\n|------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Union field `consistency_selector`. The consistency mode for this transaction. If not set, defaults to strong consistency. `consistency_selector` can be only one of the following: ||\n| `readTime` | `string (`[Timestamp](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp)` format)` Reads documents at the given time. This must be a microsecond precision timestamp within the past one hour, or if Point-in-Time Recovery is enabled, can additionally be a whole minute timestamp within the past 7 days. Uses RFC 3339, where generated output will always be Z-normalized and uses 0, 3, 6 or 9 fractional digits. Offsets other than \"Z\" are also accepted. Examples: `\"2014-10-02T15:01:23Z\"`, `\"2014-10-02T15:01:23.045123456Z\"` or `\"2014-10-02T15:01:23+05:30\"`. |\n\nReadWrite\n---------\n\nOptions for a transaction that can be used to read and write documents.\n\nFirestore does not allow 3rd party auth requests to create read-write. transactions.\n\n| JSON representation |\n|----------------------------------------|\n| ``` { \"retryTransaction\": string } ``` |\n\n| Fields ||\n|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------|\n| `retryTransaction` | `string (`[bytes](https://developers.google.com/discovery/v1/type-format)` format)` An optional transaction to retry. A base64-encoded string. |"]]