Skip to content

Commit 5423274

Browse files
authored
docs: document logical operators (And, Or, Not)
1 parent 9ecad87 commit 5423274

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ Supported **comparison operators**:
437437
- Like: `.like`
438438
- ContainsAll: `.containsAll`
439439
- ContainsAny: `.containsAny`
440+
- ContainsNone: `.containsNone`
440441
- WithinGeoRange: `.withinGeoRange`
441442

442443
Comparison operators can be grouped using **logical operators** with arbitrarily deep nesting.
@@ -456,6 +457,12 @@ Comparison operators can be grouped using **logical operators** with arbitrarily
456457
)
457458
```
458459

460+
Supported **logical operators**:
461+
462+
- And: `.and`
463+
- Or: `.or`
464+
- Not: `.not`
465+
459466
Operators passed in subsequent calls to `.where` are concatenated with the `.and` operartor.
460467
These 3 calls are equivalent:
461468

@@ -465,6 +472,13 @@ These 3 calls are equivalent:
465472
.where(cond1).where(cond2)
466473
```
467474

475+
To negate an operator, wrap it in `Where.not(...)` or use the negation shorthand.
476+
477+
```java
478+
Where.not(Where.property("title").like("summer"));
479+
Where.property("title").like("summer").not();
480+
```
481+
468482
Passing `null` and and empty `Where[]` to any of the logical operators as well as to the `.where()` method is safe -- the empty operators will simply be ignored.
469483

470484
#### Grouping results

0 commit comments

Comments
 (0)