From eeaf1414a6ca44dd7e83b500d85319bdfc1a4349 Mon Sep 17 00:00:00 2001 From: mikereiche Date: Fri, 17 Nov 2023 16:06:37 -0800 Subject: [PATCH] Use scope and collection in transaction in findByQuery.count(). Closes #1862. --- .../couchbase/core/ReactiveFindByQueryOperationSupport.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/springframework/data/couchbase/core/ReactiveFindByQueryOperationSupport.java b/src/main/java/org/springframework/data/couchbase/core/ReactiveFindByQueryOperationSupport.java index eeada0942..1bcfc85f5 100644 --- a/src/main/java/org/springframework/data/couchbase/core/ReactiveFindByQueryOperationSupport.java +++ b/src/main/java/org/springframework/data/couchbase/core/ReactiveFindByQueryOperationSupport.java @@ -256,8 +256,9 @@ public Mono count() { : rs.query(statement, opts); } else { TransactionQueryOptions opts = buildTransactionOptions(pArgs.getOptions()); - return (AttemptContextReactiveAccessor.createReactiveTransactionAttemptContext(s.get().getCore(), - clientFactory.getCluster().environment().jsonSerializer())).query(statement, opts); + JsonSerializer jSer = clientFactory.getCluster().environment().jsonSerializer(); + return AttemptContextReactiveAccessor.createReactiveTransactionAttemptContext(s.get().getCore(), jSer) + .query(OptionsBuilder.queryContext(pArgs.getScope(), pArgs.getCollection(), rs.bucketName()) == null ? null : rs, statement, opts); } });