Documentation

TransactionAttemptContext
in package

Table of Contents

$transaction  : resource
get()  : TransactionGetResult
Retrieves the value of a document from the collection.
getMulti()  : TransactionGetMultiResult
Retrieves a group of documents.
getMultiReplicasFromPreferredServerGroup()  : TransactionGetMultiReplicasFromPreferredServerGroupResult
Retrieves a group of documents, but give priority to copies from preferred server group.
getReplicaFromPreferredServerGroup()  : TransactionGetResult
Get a document copy from the selected server group.
insert()  : TransactionGetResult
Inserts a new document to the collection, failing if the document already exists.
query()  : mixed
Executes a query in the context of this transaction.
remove()  : void
Removes a document from a collection.
replace()  : TransactionGetResult
Replaces a document in a collection

Properties

Methods

getMulti()

Retrieves a group of documents.

public getMulti(array<string|int, TransactionGetMultiSpec$specs[, TransactionGetMultiOptions|null $options = null ]) : TransactionGetMultiResult
Parameters
$specs : array<string|int, TransactionGetMultiSpec>

The specs describing each entry to fetch

$options : TransactionGetMultiOptions|null = null

The options to use for the operation

Tags
since
4.3.0
Return values
TransactionGetMultiResult

result that contains set of the documents.

getMultiReplicasFromPreferredServerGroup()

Retrieves a group of documents, but give priority to copies from preferred server group.

public getMultiReplicasFromPreferredServerGroup(array<string|int, TransactionGetMultiReplicasFromPreferredServerGroupSpec$specs[, TransactionGetMultiReplicasFromPreferredServerGroupOptions|null $options = null ]) : TransactionGetMultiReplicasFromPreferredServerGroupResult
Parameters
$specs : array<string|int, TransactionGetMultiReplicasFromPreferredServerGroupSpec>

The specs describing each entry to fetch

$options : TransactionGetMultiReplicasFromPreferredServerGroupOptions|null = null

The options to use for the operation

Tags
since
4.3.0
Return values
TransactionGetMultiReplicasFromPreferredServerGroupResult

result that contains set of the documents.

getReplicaFromPreferredServerGroup()

Get a document copy from the selected server group.

public getReplicaFromPreferredServerGroup(Collection $collection, string $id[, TransactionGetReplicaOptions|null $options = null ]) : TransactionGetResult

Fetch the document contents, in the form of a @ref transaction_get_result. It might be either replica or active copy of the document. One of the use cases for this method is to save on network costs by deploying SDK in the same availability zone as corresponding server group of the nodes.

Parameters
$collection : Collection

The collection the document lives in.

$id : string

The document key to retrieve

$options : TransactionGetReplicaOptions|null = null

The options to use for the operation

Tags
since
4.2.6
Return values
TransactionGetResult

insert()

Inserts a new document to the collection, failing if the document already exists.

public insert(Collection $collection, string $id, mixed $value[, TransactionInsertOptions|null $options = null ]) : TransactionGetResult
Parameters
$collection : Collection

The collection the document lives in.

$id : string

The document key to insert.

$value : mixed

the document content to insert

$options : TransactionInsertOptions|null = null

The options to use for the operation

Tags
since
4.0.0
Return values
TransactionGetResult

        

Search results