spring-projects / spring-projects/spring-data-couchbase

query options from matching(query) not used by ReactiveFindByQueryOperationSupport.all()

Open
#1,544 3 comments 0 reactions 1 assignee View on GitHub

@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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.