Skip to content

Commit

Permalink
fix(docs): document behavior of not with NULL values (#6143)
Browse files Browse the repository at this point in the history
* document behavior of not with null values. Resolves DA-623. Resolves #3812.

* Apply suggestions from code review

---------

Co-authored-by: Ankur Datta <[email protected]>
  • Loading branch information
jharrell and ankur-arch authored Jul 9, 2024
1 parent 963ef69 commit 996054b
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions content/200-orm/500-reference/050-prisma-client-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3560,13 +3560,34 @@ const result = await prisma.user.findMany({
})
```

:::warning

`not` will return all items that do not match a given value. However, if the column is nullable, `NULL` values will not be returned. If you require null values to be returned, use an [`OR`](#or) operator to include `NULL` values.

:::

##### Return all users where `name` does **not** equal `"Eleanor"` **including** users where `name` is `NULL`

```ts
await prisma.user.findMany({
where: {
OR: [
{ name: { not: 'Eleanor' } },
{ name: null }
]
}
})
```

### `in`

Value `n` exists in list.

#### Remarks
:::note

- `null` values are not returned. For example, if you combine `in` and `NOT` to return user whose name is _not_ in the list, users with `null` value names are not returned.
`null` values are not returned. For example, if you combine `in` and `NOT` to return a user whose name is _not_ in the list, users with `null` value names are not returned.

:::

#### Examples

Expand Down

0 comments on commit 996054b

Please sign in to comment.