Skip to content

Commit fd8df0b

Browse files
authored
Merge pull request #2391 from Danielle9897/RDoc-3770-theInOperator
RDoc-3770 RQL: Explain how to negate the 'in' operator (v6.2, v7.0, v7.1)
2 parents e896450 + 34db6aa commit fd8df0b

4 files changed

Lines changed: 77 additions & 11 deletions

File tree

docs/querying/rql/what-is-rql.mdx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,11 @@ where Lines[].ProductName in ("Chang", "Spegesild", "Unknown product name")
358358

359359
---
360360

361-
**To negate an `in` condition**, use the `NOT` operator. In RQL, `NOT` cannot start a `where` clause; it must follow a **valid preceding expression.**
361+
**To negate an `in` condition**, use the `NOT` operator.
362+
In RQL, `NOT` cannot start a `where` clause; it must follow a **valid preceding expression.**
362363

363-
To ensure accuracy, especially when fields might be missing from some documents, use `exists(fieldName)` as the anchor:
364+
To ensure accuracy, especially when fields might be missing from some documents,
365+
use `exists(fieldName)` as the anchor:
364366

365367
<TabItem>
366368
```csharp
@@ -369,8 +371,9 @@ where exists(Name) and NOT Name in ("The Big Cheese", "The Cracker Box")
369371
```
370372
</TabItem>
371373

372-
**Note:** Avoid using `where true` or an `exists()` check on a *different* field. If a document is missing the field you're
373-
filtering on, these anchors may return unexpected results.
374+
**Note:**
375+
Avoid using `where true` or an `exists()` check on a *different* field.
376+
If a document is missing the field you're filtering on, these anchors may return unexpected results.
374377

375378
</ContentFrame>
376379

versioned_docs/version-6.2/client-api/session/querying/what-is-rql.mdx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,12 +347,13 @@ where PricePerUnit >= 10.5 and PricePerUnit <= 13.0 // Using >= and <=
347347
</TabItem>
348348

349349
</Admonition>
350+
350351
<Admonition type="note" title="">
351352

352353
#### Operator: &nbsp;&nbsp; `in`
353354

354-
The operator `in` is validating if a given field contains passed values.
355-
It will return results if a given field matches **any** of the passed values.
355+
The `in` operator evaluates a field against a list of values.
356+
It will return results if the field matches **any** of the items in that list.
356357

357358
<TabItem value="csharp" label="csharp">
358359
<CodeBlock language="csharp">
@@ -369,8 +370,28 @@ where Lines[].ProductName in ("Chang", "Spegesild", "Unknown product name")
369370
`}
370371
</CodeBlock>
371372
</TabItem>
373+
374+
---
375+
376+
**To negate an `in` condition**, use the `NOT` operator.
377+
In RQL, `NOT` cannot start a `where` clause; it must follow a **valid preceding expression.**
378+
379+
To ensure accuracy, especially when fields might be missing from some documents,
380+
use `exists(fieldName)` as the anchor:
381+
382+
<TabItem>
383+
```csharp
384+
from "Companies"
385+
where exists(Name) and NOT Name in ("The Big Cheese", "The Cracker Box")
386+
```
387+
</TabItem>
388+
389+
**Note:**
390+
Avoid using `where true` or an `exists()` check on a *different* field.
391+
If a document is missing the field you're filtering on, these anchors may return unexpected results.
372392

373393
</Admonition>
394+
374395
<Admonition type="note" title="">
375396

376397
#### Operator: &nbsp;&nbsp; `all in`

versioned_docs/version-7.0/client-api/session/querying/what-is-rql.mdx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,13 @@ where PricePerUnit >= 10.5 and PricePerUnit <= 13.0 // Using >= and <=
348348
</TabItem>
349349

350350
</Admonition>
351+
351352
<Admonition type="note" title="">
352353

353354
#### Operator: &nbsp;&nbsp; `in`
354355

355-
The operator `in` is validating if a given field contains passed values.
356-
It will return results if a given field matches **any** of the passed values.
356+
The `in` operator evaluates a field against a list of values.
357+
It will return results if the field matches **any** of the items in that list.
357358

358359
<TabItem value="csharp" label="csharp">
359360
<CodeBlock language="csharp">
@@ -370,8 +371,28 @@ where Lines[].ProductName in ("Chang", "Spegesild", "Unknown product name")
370371
`}
371372
</CodeBlock>
372373
</TabItem>
374+
375+
---
376+
377+
**To negate an `in` condition**, use the `NOT` operator.
378+
In RQL, `NOT` cannot start a `where` clause; it must follow a **valid preceding expression.**
379+
380+
To ensure accuracy, especially when fields might be missing from some documents,
381+
use `exists(fieldName)` as the anchor:
382+
383+
<TabItem>
384+
```csharp
385+
from "Companies"
386+
where exists(Name) and NOT Name in ("The Big Cheese", "The Cracker Box")
387+
```
388+
</TabItem>
389+
390+
**Note:**
391+
Avoid using `where true` or an `exists()` check on a *different* field.
392+
If a document is missing the field you're filtering on, these anchors may return unexpected results.
373393

374394
</Admonition>
395+
375396
<Admonition type="note" title="">
376397

377398
#### Operator: &nbsp;&nbsp; `all in`

versioned_docs/version-7.1/client-api/session/querying/what-is-rql.mdx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,14 +346,15 @@ where PricePerUnit >= 10.5 and PricePerUnit <= 13.0 // Using >= and <=
346346
`}
347347
</CodeBlock>
348348
</TabItem>
349-
349+
350350
</Admonition>
351+
351352
<Admonition type="note" title="">
352353

353354
#### Operator: &nbsp;&nbsp; `in`
354355

355-
The operator `in` is validating if a given field contains passed values.
356-
It will return results if a given field matches **any** of the passed values.
356+
The `in` operator evaluates a field against a list of values.
357+
It will return results if the field matches **any** of the items in that list.
357358

358359
<TabItem value="csharp" label="csharp">
359360
<CodeBlock language="csharp">
@@ -370,8 +371,28 @@ where Lines[].ProductName in ("Chang", "Spegesild", "Unknown product name")
370371
`}
371372
</CodeBlock>
372373
</TabItem>
374+
375+
---
376+
377+
**To negate an `in` condition**, use the `NOT` operator.
378+
In RQL, `NOT` cannot start a `where` clause; it must follow a **valid preceding expression.**
379+
380+
To ensure accuracy, especially when fields might be missing from some documents,
381+
use `exists(fieldName)` as the anchor:
382+
383+
<TabItem>
384+
```csharp
385+
from "Companies"
386+
where exists(Name) and NOT Name in ("The Big Cheese", "The Cracker Box")
387+
```
388+
</TabItem>
389+
390+
**Note:**
391+
Avoid using `where true` or an `exists()` check on a *different* field.
392+
If a document is missing the field you're filtering on, these anchors may return unexpected results.
373393

374394
</Admonition>
395+
375396
<Admonition type="note" title="">
376397

377398
#### Operator: &nbsp;&nbsp; `all in`

0 commit comments

Comments
 (0)