Skip to content

Commit

Permalink
Merge branch 'main' into document-exclude
Browse files Browse the repository at this point in the history
  • Loading branch information
jharrell authored Apr 12, 2024
2 parents ec3ed0f + 19e82c3 commit b145004
Show file tree
Hide file tree
Showing 21 changed files with 121 additions and 106 deletions.
24 changes: 12 additions & 12 deletions content/100-getting-started/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -77,32 +77,32 @@ _Select one of these options if you want to connect Prisma ORM to your own datab
<List>
<SquareLogo
url="/getting-started/setup-prisma/start-from-scratch/relational-databases-typescript-postgresql"
image={'/docs/icons/technologies/postgresqlsimple.svg'}
image={'/img/technologies/postgresqlsimple.svg'}
tech="Postgres SQL"
/>
<SquareLogo
url="/getting-started/setup-prisma/start-from-scratch/relational-databases-typescript-mysql"
image={'/docs/icons/technologies/mysqlsimple.svg'}
image={'/img/technologies/mysqlsimple.svg'}
tech="MySQL"
/>
<SquareLogo
url="/getting-started/setup-prisma/start-from-scratch/relational-databases-typescript-sqlserver"
image={'/docs/icons/technologies/sqlserver.svg'}
image={'/img/technologies/sqlserver.svg'}
tech="SQLServer"
/>
<SquareLogo
url="/getting-started/setup-prisma/start-from-scratch/relational-databases-typescript-planetscale"
image={'/docs/icons/technologies/planetscale.svg'}
image={'/img/technologies/planetscale.svg'}
tech="PlanetScale"
/>
<SquareLogo
url="/getting-started/setup-prisma/start-from-scratch/relational-databases-typescript-cockroachdb"
image={'/docs/icons/technologies/cockroachdbgradient.svg'}
image={'/img/technologies/cockroachdbgradient.svg'}
tech="Cockroach DB"
/>
<SquareLogo
url="/getting-started/setup-prisma/start-from-scratch/mongodb-typescript-mongodb"
image={'/docs/icons/technologies/mongodbsimple.svg'}
image={'/img/technologies/mongodbsimple.svg'}
tech="Mongo DB"
/>
</List>
Expand All @@ -115,32 +115,32 @@ _Select one of these options if you want to connect Prisma ORM to your own datab
<List>
<SquareLogo
url="/getting-started/setup-prisma/add-to-existing-project/relational-databases-typescript-postgresql"
image={'/docs/icons/technologies/postgresqlsimple.svg'}
image={'/img/technologies/postgresqlsimple.svg'}
tech="Postgres SQL"
/>
<SquareLogo
url="/getting-started/setup-prisma/add-to-existing-project/relational-databases-typescript-mysql"
image={'/docs/icons/technologies/mysqlsimple.svg'}
image={'/img/technologies/mysqlsimple.svg'}
tech="MySQL"
/>
<SquareLogo
url="/getting-started/setup-prisma/add-to-existing-project/relational-databases-typescript-sqlserver"
image={'/docs/icons/technologies/sqlserver.svg'}
image={'/img/technologies/sqlserver.svg'}
tech="SQL Server"
/>
<SquareLogo
url="/getting-started/setup-prisma/add-to-existing-project/relational-databases-typescript-planetscale"
image={'/docs/icons/technologies/planetscale.svg'}
image={'/img/technologies/planetscale.svg'}
tech="PlanetScale"
/>
<SquareLogo
url="/getting-started/setup-prisma/add-to-existing-project/relational-databases-typescript-cockroachdb"
image={'/docs/icons/technologies/cockroachdbgradient.svg'}
image={'/img/technologies/cockroachdbgradient.svg'}
tech="Cockroach DB"
/>
<SquareLogo
url="/getting-started/setup-prisma/add-to-existing-project/mongodb-typescript-mongodb"
image={'/docs/icons/technologies/mongodbsimple.svg'}
image={'/img/technologies/mongodbsimple.svg'}
tech="Mongo DB"
/>
</List>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,40 +109,9 @@ const createUser = await prisma.user.create({
See also: [Advanced example: Update a nested JSON key value](#advanced-example-update-a-nested-json-key-value)

## Filter on a `Json` field
## Filter on a `Json` field (simple)

From v2.23.0, you can filter rows by the data inside a `Json` type. We call this **advanced `Json` filtering**.

The availability of advanced `Json` filtering depends on your Prisma ORM version:

- V4.0.0 or later: advanced `Json` filtering is [generally available](/orm/more/releases#generally-available-ga).
- From v2.23.0, but before v4.0.0: advanced `Json` filtering is a [preview feature](/orm/reference/preview-features/client-preview-features). Add `previewFeatures = ["filterJson"]` to your schema. [Learn more](/orm/reference/preview-features/client-preview-features#enabling-a-prisma-client-preview-feature).
- Before v2.23.0: you can [filter on the exact `Json` field value](#filter-on-exact-field-value), but you cannot use the other features described in this section.

<Admonition type="warning">

Advanced `Json` filtering is supported by [PostgreSQL](/orm/overview/databases/postgresql) and [MySQL](/orm/overview/databases/mysql) only with different syntaxes for the `path` option. PostgreSQL does not support [filtering on object key values in arrays](#filtering-on-object-key-value-inside-array).

</Admonition>

### Database connector implementation differences

The implementation of `Json` filtering differs between connectors:

- The [MySQL connector](/orm/overview/databases/mysql) uses [MySQL's implementation of JSON path](https://dev.mysql.com/doc/refman/8.0/en/json.html#json-path-syntax)
- The [PostgreSQL connector](/orm/overview/databases/postgresql) uses the custom JSON functions and operators [supported in version 12 _and earlier_](https://www.postgresql.org/docs/11/functions-json.html)

This means that `path` option syntax differs between database connectors - for example, the following is a valid MySQL `path` value:

```
$petFeatures.petName
```

The following is a valid PostgreSQL `path` value:

```
["petFeatures", "petName"]
```
You can filter rows of `Json` type.

### Filter on exact field value

Expand Down Expand Up @@ -176,9 +145,48 @@ const getUsers = await prisma.user.findMany({
})
```

## Filter on a `Json` field (advanced)

You can also filter rows by the data inside a `Json` field. We call this **advanced `Json` filtering**. This functionality is supported by [PostgreSQL](/orm/overview/databases/postgresql) and [MySQL](/orm/overview/databases/mysql) only with [different syntaxes for the `path` option](#path-syntax-depending-on-database).

<Admonition type="warning">

PostgreSQL does not support [filtering on object key values in arrays](#filtering-on-object-key-value-inside-array).

</Admonition>

<Admonition type="info">

The availability of advanced `Json` filtering depends on your Prisma version:

- v4.0.0 or later: advanced `Json` filtering is [generally available](/orm/more/releases#generally-available-ga).
- From v2.23.0, but before v4.0.0: advanced `Json` filtering is a [preview feature](/orm/reference/preview-features/client-preview-features). Add `previewFeatures = ["filterJson"]` to your schema. [Learn more](/orm/reference/preview-features/client-preview-features#enabling-a-prisma-client-preview-feature).
- Before v2.23.0: you can [filter on the exact `Json` field value](#filter-on-exact-field-value), but you cannot use the other features described in this section.

</Admonition>

### <inlinecode>path</inlinecode> syntax depending on database

The filters below use a `path` option to select specific parts of the `Json` value to filter on. The implementation of that filtering differs between connectors:

- The [MySQL connector](/orm/overview/databases/mysql) uses [MySQL's implementation of JSON path](https://dev.mysql.com/doc/refman/8.0/en/json.html#json-path-syntax)
- The [PostgreSQL connector](/orm/overview/databases/postgresql) uses the custom JSON functions and operators [supported in version 12 _and earlier_](https://www.postgresql.org/docs/11/functions-json.html)

For example, the following is a valid MySQL `path` value:

```
$petFeatures.petName
```

The following is a valid PostgreSQL `path` value:

```
["petFeatures", "petName"]
```

### Filter on object property

In [2.23.0](https://github.com/prisma/prisma/releases/tag/2.23.0) and later, you can filter on a specific property inside a block of JSON. In the following examples, the value of `extendedPetsData` is a one-dimensional, unnested JSON object:
You can filter on a specific property inside a block of JSON. In the following examples, the value of `extendedPetsData` is a one-dimensional, unnested JSON object:

```json highlight=11;normal
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ In the list below, you can find a history of Prisma Client and Prisma schema fea
| [`referentialIntegrity`](/orm/prisma-schema/data-model/relations/relation-mode) | [3.1.1](https://github.com/prisma/prisma/releases/tag/3.1.1) | [4.7.0](https://github.com/prisma/prisma/releases/tag/4.7.0) |
| [`interactiveTransactions`](/orm/prisma-client/queries/transactions#interactive-transactions) | [2.29.0](https://github.com/prisma/prisma/releases/tag/2.29.0) | <ul><li> [4.7.0](https://github.com/prisma/prisma/releases/tag/4.7.0)</li><li>with Prisma Accelerate [5.1.1](https://github.com/prisma/prisma/releases/tag/5.1.1)</li></ul> |
| [`extendedIndexes`](/orm/prisma-schema/data-model/indexes) | [3.5.0](https://github.com/prisma/prisma/releases/tag/3.5.0) | [4.0.0](https://github.com/prisma/prisma/releases/tag/4.0.0) |
| [`filterJson`](/orm/prisma-client/special-fields-and-types/working-with-json-fields#filter-on-a-json-field) | [2.23.0](https://github.com/prisma/prisma/releases/tag/2.23.0) | [4.0.0](https://github.com/prisma/prisma/releases/tag/4.0.0) |
| [`filterJson`](/orm/prisma-client/special-fields-and-types/working-with-json-fields#filter-on-a-json-field-simple) | [2.23.0](https://github.com/prisma/prisma/releases/tag/2.23.0) | [4.0.0](https://github.com/prisma/prisma/releases/tag/4.0.0) |
| [`improvedQueryRaw`](/orm/prisma-client/queries/raw-database-access/raw-queries#raw-query-type-mapping) | [3.14.0](https://github.com/prisma/prisma/releases/tag/3.14.0) | [4.0.0](https://github.com/prisma/prisma/releases/tag/4.0.0) |
| [`cockroachdb`](/orm/overview/databases/cockroachdb) | <ul><li>[3.9.0](https://github.com/prisma/prisma/releases/tag/3.9.0)</li><li>migrations in CockroachDB in [3.11.0](https://github.com/prisma/prisma/releases/tag/3.11.0)</li></ul> | [3.14.0](https://github.com/prisma/prisma/releases/tag/3.14.0) |
| [`mongodb`](/orm/overview/databases/mongodb) | <ul><li>[2.27.0](https://github.com/prisma/prisma/releases/tag/2.27.0)</li><li>introspection of MongoDB in [3.2.0](https://github.com/prisma/prisma/releases/tag/3.2.0)</li><li>introspection of embedded documents in [3.4.0](https://github.com/prisma/prisma/releases/tag/3.4.0)</li><li>MongoDB embedded documents in [3.10.0](https://github.com/prisma/prisma/releases/tag/3.10.0)</li><li>introspection of embedded documents in [3.10.0](https://github.com/prisma/prisma/releases/tag/3.10.0)</li><li>raw query support for MongoDB in [3.9.0](https://github.com/prisma/prisma/releases/tag/3.9.0)</li><li>filters in embedded documents as an Experimental Feature in [3.11.0](https://github.com/prisma/prisma/releases/tag/3.11.0)</li><li>order by embedded documents in [3.11.0](https://github.com/prisma/prisma/releases/tag/3.11.0)</li></ul> | [3.12.0](https://github.com/prisma/prisma/releases/tag/3.12.0) |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ prisma.user.findMany({

#### `path` argument for filtering on JSON fields in PostgreSQL

[When filtering on JSON fields in a PostgreSQL model](/orm/prisma-client/special-fields-and-types/working-with-json-fields#filter-on-a-json-field) the `path` argument now only accepts an array.
[When filtering on JSON fields in a PostgreSQL model](/orm/prisma-client/special-fields-and-types/working-with-json-fields#filter-on-a-json-field-simple) the `path` argument now only accepts an array.

When using the following schema:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metaDescription: 'Learn how to upgrade existing Prisma 1 projects with nexus-pri

## Overview

> **Note**: This guide is not fully up-to-date as it currently uses the [deprecated](https://github.com/graphql-nexus/nexus-plugin-prisma/issues/1039) version of the [`nexus-plugin-prisma`](https://github.com/graphql-nexus/nexus-plugin-prisma). While this is still functional, it is recommended to use the new [`nexus-prisma`](https://github.com/prisma/nexus-prisma/) library or an alternative code-first GraphQL library like [Pothos](https://pothos-graphql.dev/) going forward. If you have any questions, feel free to drop them in the [`#prisma1-community`](https://app.slack.com/client/T0MQBS8JG/C0152UA4DH9) channel in the [Prisma Slack](https://slack.prisma.io).
> **Note**: This guide is not fully up-to-date as it currently uses the [deprecated](https://github.com/graphql-nexus/nexus-plugin-prisma/issues/1039) version of the [`nexus-plugin-prisma`](https://github.com/graphql-nexus/nexus-plugin-prisma). While this is still functional, it is recommended to use the new [`nexus-prisma`](https://github.com/prisma/nexus-prisma/) library or an alternative code-first GraphQL library like [Pothos](https://pothos-graphql.dev/) going forward. If you have any questions, feel free to share them on our [Discord](https://pris.ly/discord).
This upgrade guide describes how to upgrade a project that's based on [Prisma 1](https://github.com/prisma/prisma1) and uses [`nexus`](https://www.npmjs.com/package/nexus) (< v0.12.0) or [`@nexus/schema`](https://github.com/graphql-nexus/schema) together with [`nexus-prisma`](https://www.npmjs.com/package/nexus-prisma) (< v4.0.0) to implement a GraphQL server.

Expand Down
Loading

0 comments on commit b145004

Please sign in to comment.