spring-projects / spring-projects/spring-data-couchbase
query options from matching(query) not used by ReactiveFindByQueryOperationSupport.all()
Open
@mikereiche is already working on this.
Since Aug 24, 2022.
type: bug
- Dominant language
- Java
- Stars
- 284
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
query options from matching(query) not used by ReactiveFindByQueryOperationSupport.all()
@Test
@Disabled
void mmm() {
JsonObject queryPlaceholderValues = JsonValue.jo();
queryPlaceholderValues.put("$one", "a");
queryPlaceholderValues.put("$two", "two");
QueryScanConsistency scanConsistency = REQUEST_PLUS;
N1QLExpression expression = N1QLExpression.x("select * from my_bucket where firstname = $one and lastname = $two");
N1QLQuery query = buildQueryParams(expression, queryPlaceholderValues, scanConsistency);
// query.getOptions() doesn't get copied
couchbaseTemplate.findByQuery(User.class).matching(query).all();
}
public static N1QLQuery buildQueryParams(N1QLExpression expression, JsonValue queryPlaceholderValues,
QueryScanConsistency scanConsistency) {
QueryOptions opts = QueryOptions.queryOptions().scanConsistency(scanConsistency); // put the placeholders in the
// options","
if (queryPlaceholderValues instanceof JsonObject && !((JsonObject) queryPlaceholderValues).isEmpty()) {
opts.parameters((JsonObject) queryPlaceholderValues);
} else if (queryPlaceholderValues instanceof JsonArray && !((JsonArray) queryPlaceholderValues).isEmpty()) {
opts.parameters((JsonArray) queryPlaceholderValues);
}
return new N1QLQuery(expression, opts);
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.