From 0a3ec947b9b816a583ef3e141abae7d14ff355f2 Mon Sep 17 00:00:00 2001 From: Alexey Timin Date: Tue, 26 Nov 2024 13:55:36 +0100 Subject: [PATCH 1/3] document comparison operators; include/exclude deprecated --- .../comparison-operators.mdx | 224 ++++++++++++++++++ docs/conditional-query/logical-operators.mdx | 16 +- docs/http-api/entry-api/run_query.mdx | 2 + 3 files changed, 234 insertions(+), 8 deletions(-) diff --git a/docs/conditional-query/comparison-operators.mdx b/docs/conditional-query/comparison-operators.mdx index 24249800..668d526e 100644 --- a/docs/conditional-query/comparison-operators.mdx +++ b/docs/conditional-query/comparison-operators.mdx @@ -2,3 +2,227 @@ title: Comparison Operators description: Learn how to use comparison operators in conditional queries to filter data in ReductStore. --- + + + + + +The comparison operators are used to compare values in a query. + +The following comparison operators are supported: + +| Operator | Description | +| -------- | --------------------------------------------------------------------------- | +| `$eq` | Equal. Returns true if the values are equal. | +| `$ne` | Not equal. Returns true if the values are not equal. | +| `$gt` | Greater than. Returns true if the first value is greater than the second. | +| `$gte` | Greater than or equal. Returns true if the first value is greater or equal. | +| `$lt` | Less than. Returns true if the first value is less than the second. | +| `$lte` | Less than or equal. Returns true if the first value is less or equal. | + +## $eq + +The `$eq` operator is used to compare values for equality. + +### Syntax + +``` +{ + "$eq": [ , ] +} +``` + +### Behavior + +The operator returns true if the values of the two expressions are equal. + +### Examples + +Object notation: + +```json +{ + "&label_name": { "$eq": 10 } +} +``` + +Array notation: + +```json +{ + "$eq": ["&label_name", 10] +} +``` + +## $ne + +The `$ne` operator is used to compare values for inequality. + +### Syntax + +``` +{ + "$ne": [ , ] +} +``` + +### Behavior + +The operator returns true if the values of the two expressions are not equal. + +### Examples + +Object notation: + +```json +{ + "&label_name": { "$ne": 10 } +} +``` + +Array notation: + +```json +{ + "$ne": ["&label_name", 10] +} +``` + +## $gt + +The `$gt` operator is used to compare values for greater than. + +### Syntax + +``` +{ + "$gt": [ , ] +} +``` + +### Behavior + +The operator returns true if the value of the first expression is greater than the value of the second expression. + +### Examples + +Object notation: + +```json +{ + "&label_name": { "$gt": 10 } +} +``` + +Array notation: + +```json +{ + "$gt": ["&label_name", 10] +} +``` + +## $gte + +The `$gte` operator is used to compare values for greater than or equal. + +### Syntax + +``` +{ + "$gte": [ , ] +} +``` + +### Behavior + +The operator returns true if the value of the first expression is greater than or equal to the value of the second expression. + +### Examples + +Object notation: + +```json +{ + "&label_name": { "$gte": 10 } +} +``` + +Array notation: + +```json +{ + "$gte": ["&label_name", 10] +} +``` + +## $lt + +The `$lt` operator is used to compare values for less than. + +### Syntax + +``` +{ + "$lt": [ , ] +} +``` + +### Behavior + +The operator returns true if the value of the first expression is less than the value of the second expression. + +### Examples + +Object notation: + +```json +{ + "&label_name": { "$lt": 10 } +} +``` + +Array notation: + +```json +{ + "$lt": ["&label_name", 10] +} +``` + +## $lte + +The `$lte` operator is used to compare values for less than or equal. + +### Syntax + +``` +{ + "$lte": [ , ] +} +``` + +### Behavior + +The operator returns true if the value of the first expression is less than or equal to the value of the second expression. + +### Examples + +Object notation: + +```json +{ + "&label_name": { "$lte": 10 } +} +``` + +Array notation: + +```json +{ + "$lte": ["&label_name", 10] +} +``` diff --git a/docs/conditional-query/logical-operators.mdx b/docs/conditional-query/logical-operators.mdx index 12ae784e..4631b25a 100644 --- a/docs/conditional-query/logical-operators.mdx +++ b/docs/conditional-query/logical-operators.mdx @@ -30,8 +30,8 @@ The `$and` or `$all_of` operator is used to combine multiple conditions in a que ``` { "$and" | "$all_of: [ - { expression_1 }, - { expression_2}, + { }, + { }, ... ] } @@ -73,8 +73,8 @@ The `$or` or `$any_of` operator is used to combine multiple conditions in a quer ``` { "$or" | "$any_of": [ - { expression_1 }, - { expression_2}, + { }, + { }, ... ] } @@ -115,8 +115,8 @@ The `$xor` or `$one_of` operator is used to combine multiple conditions in a que ``` { "$xor" | "$one_of": [ - { expression_1 }, - { expression_2 }, + { }, + { }, ... ] } @@ -157,8 +157,8 @@ The `$not` or `$none_of` operator is used to negate a condition in a query. The ``` { "$not" | "$none_of": [ - { expression_1 }, - { expression_2 }, + { }, + { }, ] } ``` diff --git a/docs/http-api/entry-api/run_query.mdx b/docs/http-api/entry-api/run_query.mdx index 72f623d8..cbb09d75 100644 --- a/docs/http-api/entry-api/run_query.mdx +++ b/docs/http-api/entry-api/run_query.mdx @@ -102,10 +102,12 @@ The request body should be a JSON object with the following parameters: // Optional. A list of labels to include in the query. // Only records with all the specified labels are included. + // DEPRECATED: Use "when" instead. include?: "Dict[string, string]" // Optional. A list of labels to exclude in the query. // Records with any of the specified labels are excluded. + // DEPRECATED: Use "when" instead. exclude?: "Dict[string, string]" // Optional. A conditional query to filter records. From b1c43b76b82b069b5463f096daf4a809a131c26a Mon Sep 17 00:00:00 2001 From: Alexey Timin Date: Tue, 26 Nov 2024 14:02:21 +0100 Subject: [PATCH 2/3] fix typos --- docs/http-api/entry-api/delete_data.mdx | 2 +- docs/http-api/entry-api/read_data.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/http-api/entry-api/delete_data.mdx b/docs/http-api/entry-api/delete_data.mdx index 48e3ec7d..4bf75a3a 100644 --- a/docs/http-api/entry-api/delete_data.mdx +++ b/docs/http-api/entry-api/delete_data.mdx @@ -186,7 +186,7 @@ If authentication is enabled, the method needs a valid API token with read acces - Version 1.12: the method was introduced. :::warning -Since version 1.13, te method is deprecated. Use the [**Query API**](/docs/http-api/entry-api/run_query.mdx) instead. +Since version 1.13, the method is deprecated. Use the [**Query API**](/docs/http-api/entry-api/run_query.mdx) instead. ::: Date: Wed, 27 Nov 2024 14:09:32 +0100 Subject: [PATCH 3/3] review --- docs/conditional-query/comparison-operators.mdx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/conditional-query/comparison-operators.mdx b/docs/conditional-query/comparison-operators.mdx index 668d526e..d1561ba2 100644 --- a/docs/conditional-query/comparison-operators.mdx +++ b/docs/conditional-query/comparison-operators.mdx @@ -14,14 +14,14 @@ The comparison operators are used to compare values in a query. The following comparison operators are supported: -| Operator | Description | -| -------- | --------------------------------------------------------------------------- | -| `$eq` | Equal. Returns true if the values are equal. | -| `$ne` | Not equal. Returns true if the values are not equal. | -| `$gt` | Greater than. Returns true if the first value is greater than the second. | -| `$gte` | Greater than or equal. Returns true if the first value is greater or equal. | -| `$lt` | Less than. Returns true if the first value is less than the second. | -| `$lte` | Less than or equal. Returns true if the first value is less or equal. | +| Operator | Description | +| -------- | ------------------------------------------------------------------------------------------- | +| `$eq` | Equal. Returns true if the values are equal. | +| `$ne` | Not equal. Returns true if the values are not equal. | +| `$gt` | Greater than. Returns true if the first value is greater than the second. | +| `$gte` | Greater than or equal. Returns true if the first value is greater than the second or equal. | +| `$lt` | Less than. Returns true if the first value is less than the second. | +| `$lte` | Less than or equal. Returns true if the first value is less than the second or equal. | ## $eq