Class ReactiveTransactionAttemptContext
-
Method Summary
Modifier and TypeMethodDescriptionget
(ReactiveCollection collection, String id) Gets a document with the specifiedid
and from the specified Couchbasecollection
.get
(ReactiveCollection collection, String id, TransactionGetOptions options) Gets a document with the specifiedid
and from the specified Couchbasecollection
.insert
(ReactiveCollection collection, String id, Object content) Inserts a new document into the specified Couchbasecollection
.insert
(ReactiveCollection collection, String id, Object content, TransactionInsertOptions options) Inserts a new document into the specified Couchbasecollection
.query
(ReactiveScope scope, String statement) Runs a N1QL query and returns the result, with default parameters.query
(ReactiveScope scope, String statement, TransactionQueryOptions options) Runs a N1QL query and returns the result.Calls query() with default options.query
(String statement, TransactionQueryOptions options) Runs a N1QL query and returns the result.Removes the specifieddoc
.replace
(TransactionGetResult doc, Object content) Mutates the specifieddoc
with new content.replace
(TransactionGetResult doc, Object content, TransactionReplaceOptions options) Mutates the specifieddoc
with new content.
-
Method Details
-
get
Gets a document with the specifiedid
and from the specified Couchbasecollection
.If the document does not exist it will throw a
DocumentNotFoundException
.- Parameters:
collection
- the Couchbase collection the document exists onid
- the document's ID- Returns:
- a
TransactionGetResult
containing the document
-
get
public Mono<TransactionGetResult> get(ReactiveCollection collection, String id, TransactionGetOptions options) Gets a document with the specifiedid
and from the specified Couchbasecollection
.If the document does not exist it will throw a
DocumentNotFoundException
.- Parameters:
collection
- the Couchbase collection the document exists onid
- the document's IDoptions
- options controlling the operation- Returns:
- a
TransactionGetResult
containing the document
-
insert
Inserts a new document into the specified Couchbasecollection
.- Parameters:
collection
- the Couchbase collection in which to insert the docid
- the document's unique IDcontent
- the content to insert- Returns:
- the doc, updated with its new CAS value and ID, and converted to a
TransactionGetResult
-
insert
public Mono<TransactionGetResult> insert(ReactiveCollection collection, String id, Object content, TransactionInsertOptions options) Inserts a new document into the specified Couchbasecollection
.- Parameters:
collection
- the Couchbase collection in which to insert the docid
- the document's unique IDcontent
- the content to insertoptions
- options controlling the operation- Returns:
- the doc, updated with its new CAS value and ID, and converted to a
TransactionGetResult
-
replace
Mutates the specifieddoc
with new content.- Parameters:
doc
- the doc to be mutatedcontent
- the content to replace the doc with- Returns:
- the doc, updated with its new CAS value. For performance a copy is not created and the original doc object is modified.
-
replace
public Mono<TransactionGetResult> replace(TransactionGetResult doc, Object content, TransactionReplaceOptions options) Mutates the specifieddoc
with new content.- Parameters:
doc
- the doc to be mutatedcontent
- the content to replace the doc withoptions
- options controlling the operation- Returns:
- the doc, updated with its new CAS value. For performance a copy is not created and the original doc object is modified.
-
remove
Removes the specifieddoc
.- Parameters:
doc
- - the doc to be removed
-
query
Calls query() with default options. -
query
Runs a N1QL query and returns the result.All rows are buffered in-memory.
Raises CouchbaseException or an error derived from it on failure. The application can choose to catch and ignore this error, and the transaction attempt is allowed to continue. This differs from Key-Value operations, whose failure will cause the attempt to fail.
-
query
Runs a N1QL query and returns the result, with default parameters.All rows are buffered in-memory.
This overload performs a 'scope-level query': that is, one in which a collection may be referenced by name in the query statement, without needing to specify the full bucket.scope.collection syntax.
Raises CouchbaseException or an error derived from it on failure. The application can choose to catch and ignore this error, and the transaction attempt is allowed to continue. This differs from Key-Value operations, whose failure will cause the attempt to fail.
-
query
public Mono<TransactionQueryResult> query(ReactiveScope scope, String statement, TransactionQueryOptions options) Runs a N1QL query and returns the result.All rows are buffered in-memory.
This overload performs a 'scope-level query': that is, one in which a collection may be referenced by name in the query statement, without needing to specify the full bucket.scope.collection syntax.
Raises CouchbaseException or an error derived from it on failure. The application can choose to catch and ignore this error, and the transaction attempt is allowed to continue. This differs from Key-Value operations, whose failure will cause the attempt to fail.
-