updates

This commit is contained in:
JMARyA 2025-05-06 23:43:23 +02:00
parent 77185abd6a
commit b1ad069731
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
4 changed files with 114 additions and 8 deletions

View file

@ -40,10 +40,10 @@ This filter would match all of these objects:
```
but not:
```json
{ "key": "Lol"}
{ "key": "lol"}
```
## Operators
## Logical Operators
### `$and`
Chain multiple filters together. All must evaluate to `true`
```json
@ -72,6 +72,7 @@ Inverts the result of the nested filter expression.
{ "$not": { "key": "value" }}
```
## Comparison Operators
### `$lt` & `$lte`
Evaluates to `true` if the value is less than or less than equal the specified value.
```json
@ -90,7 +91,10 @@ Evaluates to `true` if the value is not equal to the specified value.
{ "key": { "$ne": "value" }}
```
### `$in`
> **Note**: The `$eq` operator is implicit. Example: `{ "key": "value" }`
## Array / Object Operators
### `$in` & `$contains`
Evaluates to `true` if the value exists in the specified array.
```json
{ "array": { "$in": "value" }}
@ -115,12 +119,20 @@ Evaluates to `true` if the array length matches the specified value
{ "array": { "$size": 5 }}
```
## Text Operators
### `$regex`
Evaluates to `true` if the value matches the regular expression pattern.
```json
{ "key": { "$regex": "^regex" }}
```
### `$contains`
Evaluates to `true` if the value contains the text.
```json
{ "key": { "$contains": "text" }}
```
## Misc Operators
### `$type`
Evaluates to `true` if the value matches the specified type.
```json
@ -130,4 +142,11 @@ Evaluates to `true` if the value matches the specified type.
{ "key": { "$type": "object" }}
{ "key": { "$type": "array" }}
{ "key": { "$type": "boolean" }}
```
```
### `$range`
Evaluates to `true` if the value is within the specified range. This operator is actually just syntactic sugar for `let filter = json!({"$and": [{"key": {"$gte": x}}, {"key": {"$lte": y}}]});`.
```json
{"key": { "$range": [x, y] }}
```