Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,12 @@ public QueryCriteria arrayContaining(@Nullable Object o) {
}

public QueryCriteria arrayContaining(boolean ignoreCase, @Nullable Object o) {
operator = "array_containing";
operator = "array_contains";
if (ignoreCase) {
throw new CouchbaseException("ignoreCase not supported in IN and NOT_IN");
}
value = new Object[] { o };
format = "array_containing(%1$s, %3$s)";
format = "array_contains(%1$s, %3$s)";
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ void findByMatchingQuery() {
.matching(specialUsers).all();

assertEquals(1, foundUsers.size());

Query arrayContaining = new Query(QueryCriteria.where(i("firstname")).arrayContaining("not_match_anything"));
final List<User> foundArrayContaining = couchbaseTemplate.findByQuery(User.class).withConsistency(REQUEST_PLUS)
.matching(arrayContaining).all();
assertEquals(0, foundArrayContaining.size());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void testNotContaining() {
@Test
void testArrayContaining() {
QueryCriteria c = where(i("name")).arrayContaining("Elvis");
assertEquals("array_containing(`name`, \"Elvis\")", c.export());
assertEquals("array_contains(`name`, \"Elvis\")", c.export());
}

@Test
Expand Down