From a0929046dc24a6d1170f66bd71183e39b28e0bad Mon Sep 17 00:00:00 2001 From: Sabin Adams Date: Thu, 23 Mar 2023 19:42:39 -0700 Subject: [PATCH 1/7] Removes existing sections on compound ID in Prisma Client and adds a new dedicated page --- .../01-prisma-schema/04-data-model.mdx | 21 ++ .../02-prisma-client/030-crud.mdx | 93 -------- .../300-working-with-composite-ids.mdx | 206 ++++++++++++++++++ .../051-working-with-fields/index.mdx | 4 + 4 files changed, 231 insertions(+), 93 deletions(-) create mode 100644 content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids.mdx diff --git a/content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx b/content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx index f48985c874..e0e224d084 100644 --- a/content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx +++ b/content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx @@ -630,6 +630,27 @@ model User { } ``` +By default, the name of this field in Prisma Client queries will be `firstName_lastName`. + +You can also provide your own name for the composite ID using the [`@@id`](/reference/api-reference/prisma-schema-reference#id-1) attribute's `name` field: + +```prisma highlight=7;normal +model User { + firstName String + lastName String + email String @unique + isAdmin Boolean @default(false) + + @@id(name: "fullName", fields: [firstName, lastName]) +} +``` + + + +Refer to the documentation on [working with composite IDs](/concepts/components/prisma-client/working-with-fields/working-with-composite-ids) to learn how to interact with a composite ID in Prisma Client. + + + ##### @unique fields as unique identifiers In the following example, users are uniquely identified by a `@unique` field. Because the `email` field functions as a unique identifier for the model (which is required by Prisma), it must be mandatory: diff --git a/content/200-concepts/100-components/02-prisma-client/030-crud.mdx b/content/200-concepts/100-components/02-prisma-client/030-crud.mdx index 5980a0fd77..1dcbec071c 100644 --- a/content/200-concepts/100-components/02-prisma-client/030-crud.mdx +++ b/content/200-concepts/100-components/02-prisma-client/030-crud.mdx @@ -327,99 +327,6 @@ const user = await prisma.user.findUnique({ }) ``` -### Get record by compound ID or compound unique identifier - - - -**MongoDB does not support `@@id`**
-MongoDB does not support composite IDs, which means you cannot identify a model with a `@@id` attribute. - -
- -The following examples demonstrate how to retrieve records by a compound ID or unique identifier, defined by [`@@id`](/reference/api-reference/prisma-schema-reference#id-1) or [`@@unique`](/reference/api-reference/prisma-schema-reference#unique-1) . - -The following Prisma model defines a compound ID: - -]}> - - -```prisma highlight=6;normal -model TimePeriod { - year Int - quarter Int - total Decimal - - @@id([year, quarter]) -} -``` - - - - - - -To retrieve a time period by this compound ID, use the generated `year_quarter` field, which follows the `fieldName1_fieldName2` pattern: - -]}> - - -```ts -const timePeriod = await prisma.timePeriod.findUnique({ - where: { - year_quarter: { - quarter: 4, - year: 2020, - }, - }, -}) -``` - - - - - - -The following Prisma model defines a compound unique identifier with a custom name (`timePeriodId`) - -]}> - - -```prisma highlight=6;normal -model TimePeriod { - year Int - quarter Int - total Decimal - - @@unique(fields: [year, quarter], name: "timePeriodId") -} -``` - - - - - - -To retrieve a time period by this unique identifier, use the custom `timePeriodId` field: - -]}> - - -```ts -const timePeriod = await prisma.timePeriod.findUnique({ - where: { - timePeriodId: { - quarter: 4, - year: 2020, - }, - }, -}) -``` - - - - - - ### Get all records The following [`findMany`](/reference/api-reference/prisma-client-reference#findmany) query returns _all_ `User` records: diff --git a/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids.mdx b/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids.mdx new file mode 100644 index 0000000000..a6e564c7d9 --- /dev/null +++ b/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids.mdx @@ -0,0 +1,206 @@ +--- +title: 'Working with compound IDs and unique identifiers' +metaTitle: 'Working with compound IDs and unique identifiers (Concepts)' +metaDescription: 'How to read, write, and filter by compound IDs and unique identifiers.' +tocDepth: 2 +--- + + + +Composite IDs and compound unique identifiers can be defined in your Prisma schema using the [`@@id`](/reference/api-reference/prisma-schema-reference#id-1) and [`@@unique`](/reference/api-reference/prisma-schema-reference#unique-1) attributes. + + + +**MongoDB does not support `@@id`**
+MongoDB does not support composite IDs, which means you cannot identify a model with a `@@id` attribute. + +
+ +A composite ID or compound unique identifier uses the combined values of two fields as a primary key or identifier in your database table. In the following example, the `postId` field and `userId` field are used as a composite ID for a `Like` table: + +```prisma highlight=22;normal +model User { + id Int @id @default(autoincrement()) + name String + post Post[] + likes Like[] +} + +model Post { + id Int @id @default(autoincrement()) + content String + User User? @relation(fields: [userId], references: [id]) + userId Int? + likes Like[] +} + +model Like { + postId Int + userId Int + User User @relation(fields: [userId], references: [id]) + Post Post @relation(fields: [postId], references: [id]) + + @@id([postId, userId]) +} +``` + +Querying for record from the `Like` table would yield results that look like the following: + +```json +{ + "postId": 1, + "userId": 1 +} +``` + +Although there are only two fields in the response, those two fields make up a compound ID named `postId_userId`. + +You can also create a named compound ID or compound unique identifier by using the `@@id` or `@@unique` attributes' `name` field. For example: + +```prisma highlight=7;normal +model Like { + postId Int + userId Int + User User @relation(fields: [userId], references: [id]) + Post Post @relation(fields: [postId], references: [id]) + + @@id(name: "likeId", [postId, userId]) +} +``` + +
+ +## Where you can use compound IDs and unique identifiers + +Compound IDs and compound unique identifiers can be used when working with _unique_ data. + +Below is a list of Prisma Client functions where a compound ID or compound unique identifier can be used in the `where` filter of the query: + +- `findUnique` +- `findUniqueOrThrow` +- `delete` +- `update` +- `upsert` + +A composite ID and a composite unique identifier will also show up when creating relational data with `connect` and `connectOrCreate`. + +## Filtering records by a compound ID or unique identifier + +Although your query results will not display a compound ID or unique identifier as a field, you can use these compound values to filter your queries for unique records: + +```ts highlight=3-6;normal +const like = await prisma.like.findUnique({ + where: { + likeId: { + userId: 1, + postId: 1, + }, + }, +}) +``` + + + +Note composite ID and compound unique identifier keys are only available as filter options for _unique_ queries such as `findUnique` and `findUniqueOrThrow`. See the [section](/concepts/components/prisma-client/working-with-fields/working-with-composite-ids/#where-you-can-use-compound-ids-and-unique-identifiers) above for a list of places these fields may be used. + + + +## Deleting records by a compound ID or unique identifier + +A compound ID or compound unique identifier may be used in the `where` filter of a `delete` query: + +```ts highlight=3-6;normal +const like = await prisma.like.delete({ + where: { + likeId: { + userId: 1, + postId: 1, + }, + }, +}) +``` + +## Updating and upserting records by a compound ID or unique identifier + +A compound ID or compound unique identifier may be used in the `where` filter of an `update` query: + +```ts highlight=3-6;normal +const like = await prisma.like.update({ + where: { + likeId: { + userId: 1, + postId: 1, + }, + }, + data: { + postId: 2, + }, +}) +``` + +They may also be used in the `where` filter of an `upsert` query: + +```ts highlight=3-6;normal +await prisma.like.upsert({ + where: { + likeId: { + userId: 1, + postId: 1, + }, + }, + update: { + userId: 2, + }, + create: { + userId: 2, + postId: 1, + }, +}) +``` + +## Filtering relation queries by a compound ID or unique identifier + +Compound IDs and compound unique identifiers can also be used in the `connect` and `connectOrCreate` keys used when connecting records to create a relationship. + +For example, consider this query: + +```ts highlight=6-9;normal +await prisma.user.create({ + data: { + name: 'Alice', + likes: { + connect: { + likeId: { + postId: 1, + userId: 2, + }, + }, + }, + }, +}) +``` + +The `likeId` compound ID is used as the identifier in the `connect` object that is used to locate the `Like` table's record that will be linked to the new user: `"Alice"`. + +Similarly, the `likeId` can be used in `connectOrCreate`'s `where` filter to attempt to locate an existing record in the `Like` table: + +```ts highlight=10-13;normal +await prisma.user.create({ + data: { + name: 'Alice', + likes: { + connectOrCreate: { + create: { + postId: 1, + }, + where: { + likeId: { + postId: 1, + userId: 1, + }, + }, + }, + }, + }, +}) +``` diff --git a/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/index.mdx b/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/index.mdx index fbc85b9e06..5e46c32c01 100644 --- a/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/index.mdx +++ b/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/index.mdx @@ -83,3 +83,7 @@ See: [Working with `Json` fields](working-with-json-fields) ## Working with scalar lists / scalar arrays See: [Working with scalar lists / arrays](working-with-scalar-lists-arrays) + +## Working with composite IDs and compound unique identifiers + +See: [Working with composite IDs and compound unique identifiers](working-with-composite-ids) From b54127568c43bc5f0147e6db14a4593f3211ef38 Mon Sep 17 00:00:00 2001 From: Sabin Adams Date: Thu, 23 Mar 2023 19:58:56 -0700 Subject: [PATCH 2/7] Updates wording and adds clarifying message to as well --- .../01-prisma-schema/04-data-model.mdx | 28 ++++++++++++++ ...ng-with-composite-ids-and-constraints.mdx} | 38 +++++++++---------- .../051-working-with-fields/index.mdx | 2 +- 3 files changed, 48 insertions(+), 20 deletions(-) rename content/200-concepts/100-components/02-prisma-client/051-working-with-fields/{300-working-with-composite-ids.mdx => 300-working-with-composite-ids-and-constraints.mdx} (73%) diff --git a/content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx b/content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx index e0e224d084..5c66d3864a 100644 --- a/content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx +++ b/content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx @@ -645,6 +645,8 @@ model User { } ``` +The `firstName_lastName` field will now be named `fullName` instead. + Refer to the documentation on [working with composite IDs](/concepts/components/prisma-client/working-with-fields/working-with-composite-ids) to learn how to interact with a composite ID in Prisma Client. @@ -840,6 +842,32 @@ You can optionally define a [custom unique constraint name](/concepts/components +By default, the name of this field in Prisma Client queries will be `authorId_title`. + +You can also provide your own name for the composite unique constraint using the [`@@unique`](/concepts/components/prisma-schema/names-in-underlying-database#constraint-and-index-names) attribute's `name` field: + +```prisma highlight=10;normal +model Post { + id String @id @default(auto()) @map("_id") @db.ObjectId + createdAt DateTime @default(now()) + title String + published Boolean @default(false) + author User @relation(fields: [authorId], references: [id]) + authorId String @db.ObjectId + categories Category[] @relation(references: [id]) + + @@unique(name: "authorTitle", [authorId, title]) +} +``` + +The `authorId_title` field will now be named `authorTitle` instead. + + + +Refer to the documentation on [working with composite unique identifiers](/concepts/components/prisma-client/working-with-fields/working-with-composite-ids) to learn how to interact with a composite unique constraints in Prisma Client. + + + #### Composite type unique constraints When using the MongoDB provider in version `3.12.0` and later, you can define a unique constraint on a field of a [composite type](#defining-composite-types) using the syntax `@@unique([compositeType.field])`. As with other fields, composite type fields can be used as part of a multi-column unique constraint. diff --git a/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids.mdx b/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids-and-constraints.mdx similarity index 73% rename from content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids.mdx rename to content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids-and-constraints.mdx index a6e564c7d9..d16cc9e24f 100644 --- a/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids.mdx +++ b/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids-and-constraints.mdx @@ -1,13 +1,13 @@ --- -title: 'Working with compound IDs and unique identifiers' -metaTitle: 'Working with compound IDs and unique identifiers (Concepts)' -metaDescription: 'How to read, write, and filter by compound IDs and unique identifiers.' +title: 'Working with compound IDs and unique constraints' +metaTitle: 'Working with compound IDs and unique constraints (Concepts)' +metaDescription: 'How to read, write, and filter by compound IDs and unique constraints.' tocDepth: 2 --- -Composite IDs and compound unique identifiers can be defined in your Prisma schema using the [`@@id`](/reference/api-reference/prisma-schema-reference#id-1) and [`@@unique`](/reference/api-reference/prisma-schema-reference#unique-1) attributes. +Composite IDs and compound unique constraints can be defined in your Prisma schema using the [`@@id`](/reference/api-reference/prisma-schema-reference#id-1) and [`@@unique`](/reference/api-reference/prisma-schema-reference#unique-1) attributes. @@ -16,7 +16,7 @@ MongoDB does not support composite IDs, which means you cannot identify a model -A composite ID or compound unique identifier uses the combined values of two fields as a primary key or identifier in your database table. In the following example, the `postId` field and `userId` field are used as a composite ID for a `Like` table: +A composite ID or compound unique constraint uses the combined values of two fields as a primary key or identifier in your database table. In the following example, the `postId` field and `userId` field are used as a composite ID for a `Like` table: ```prisma highlight=22;normal model User { @@ -55,7 +55,7 @@ Querying for record from the `Like` table would yield results that look like the Although there are only two fields in the response, those two fields make up a compound ID named `postId_userId`. -You can also create a named compound ID or compound unique identifier by using the `@@id` or `@@unique` attributes' `name` field. For example: +You can also create a named compound ID or compound unique constraint by using the `@@id` or `@@unique` attributes' `name` field. For example: ```prisma highlight=7;normal model Like { @@ -70,11 +70,11 @@ model Like { -## Where you can use compound IDs and unique identifiers +## Where you can use compound IDs and unique constraints -Compound IDs and compound unique identifiers can be used when working with _unique_ data. +Compound IDs and compound unique constraints can be used when working with _unique_ data. -Below is a list of Prisma Client functions where a compound ID or compound unique identifier can be used in the `where` filter of the query: +Below is a list of Prisma Client functions that accept a compound ID or compound unique constraint in the `where` filter of the query: - `findUnique` - `findUniqueOrThrow` @@ -82,11 +82,11 @@ Below is a list of Prisma Client functions where a compound ID or compound uniqu - `update` - `upsert` -A composite ID and a composite unique identifier will also show up when creating relational data with `connect` and `connectOrCreate`. +A composite ID and a composite unique constraint is also usable when creating relational data with `connect` and `connectOrCreate`. -## Filtering records by a compound ID or unique identifier +## Filtering records by a compound ID or unique constraint -Although your query results will not display a compound ID or unique identifier as a field, you can use these compound values to filter your queries for unique records: +Although your query results will not display a compound ID or unique constraint as a field, you can use these compound values to filter your queries for unique records: ```ts highlight=3-6;normal const like = await prisma.like.findUnique({ @@ -101,13 +101,13 @@ const like = await prisma.like.findUnique({ -Note composite ID and compound unique identifier keys are only available as filter options for _unique_ queries such as `findUnique` and `findUniqueOrThrow`. See the [section](/concepts/components/prisma-client/working-with-fields/working-with-composite-ids/#where-you-can-use-compound-ids-and-unique-identifiers) above for a list of places these fields may be used. +Note composite ID and compound unique constraint keys are only available as filter options for _unique_ queries such as `findUnique` and `findUniqueOrThrow`. See the [section](/concepts/components/prisma-client/working-with-fields/working-with-composite-ids/#where-you-can-use-compound-ids-and-unique-identifiers) above for a list of places these fields may be used. -## Deleting records by a compound ID or unique identifier +## Deleting records by a compound ID or unique constraint -A compound ID or compound unique identifier may be used in the `where` filter of a `delete` query: +A compound ID or compound unique constraint may be used in the `where` filter of a `delete` query: ```ts highlight=3-6;normal const like = await prisma.like.delete({ @@ -120,9 +120,9 @@ const like = await prisma.like.delete({ }) ``` -## Updating and upserting records by a compound ID or unique identifier +## Updating and upserting records by a compound ID or unique constraint -A compound ID or compound unique identifier may be used in the `where` filter of an `update` query: +A compound ID or compound unique constraint may be used in the `where` filter of an `update` query: ```ts highlight=3-6;normal const like = await prisma.like.update({ @@ -158,9 +158,9 @@ await prisma.like.upsert({ }) ``` -## Filtering relation queries by a compound ID or unique identifier +## Filtering relation queries by a compound ID or unique constraint -Compound IDs and compound unique identifiers can also be used in the `connect` and `connectOrCreate` keys used when connecting records to create a relationship. +Compound IDs and compound unique constraint can also be used in the `connect` and `connectOrCreate` keys used when connecting records to create a relationship. For example, consider this query: diff --git a/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/index.mdx b/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/index.mdx index 5e46c32c01..42c546ce02 100644 --- a/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/index.mdx +++ b/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/index.mdx @@ -86,4 +86,4 @@ See: [Working with scalar lists / arrays](working-with-scalar-lists-arrays) ## Working with composite IDs and compound unique identifiers -See: [Working with composite IDs and compound unique identifiers](working-with-composite-ids) +See: [Working with composite IDs and compound unique constraints](working-with-composite-ids-and-constraints) From cb3abcd5a15a163a3f44c722d476ea94fefa6693 Mon Sep 17 00:00:00 2001 From: Sabin Adams Date: Thu, 23 Mar 2023 20:03:20 -0700 Subject: [PATCH 3/7] identifier -> constraint --- .../02-prisma-client/051-working-with-fields/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/index.mdx b/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/index.mdx index 42c546ce02..58a588f706 100644 --- a/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/index.mdx +++ b/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/index.mdx @@ -84,6 +84,6 @@ See: [Working with `Json` fields](working-with-json-fields) See: [Working with scalar lists / arrays](working-with-scalar-lists-arrays) -## Working with composite IDs and compound unique identifiers +## Working with composite IDs and compound unique constraints See: [Working with composite IDs and compound unique constraints](working-with-composite-ids-and-constraints) From e39a7a81a905890dbb38fd811195540f08bf7966 Mon Sep 17 00:00:00 2001 From: Nikolas Date: Thu, 23 Nov 2023 17:06:05 +0100 Subject: [PATCH 4/7] Update content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx --- .../100-components/01-prisma-schema/04-data-model.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx b/content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx index 5aa7af2de9..ea7f04e406 100644 --- a/content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx +++ b/content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx @@ -656,7 +656,7 @@ The `firstName_lastName` field will now be named `fullName` instead. -Refer to the documentation on [working with composite IDs](/concepts/components/prisma-client/working-with-fields/working-with-composite-ids) to learn how to interact with a composite ID in Prisma Client. +Refer to the documentation on [working with composite IDs](/concepts/components/prisma-client/working-with-fields/working-with-composite-ids-and-constraints) to learn how to interact with a composite ID in Prisma Client. From 8f779e037deb808ce778fbf973501dadf6c7e09e Mon Sep 17 00:00:00 2001 From: Nikolas Date: Thu, 23 Nov 2023 17:07:11 +0100 Subject: [PATCH 5/7] Update content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx --- .../100-components/01-prisma-schema/04-data-model.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx b/content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx index ea7f04e406..cf742d158c 100644 --- a/content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx +++ b/content/200-concepts/100-components/01-prisma-schema/04-data-model.mdx @@ -871,7 +871,7 @@ The `authorId_title` field will now be named `authorTitle` instead. -Refer to the documentation on [working with composite unique identifiers](/concepts/components/prisma-client/working-with-fields/working-with-composite-ids) to learn how to interact with a composite unique constraints in Prisma Client. +Refer to the documentation on [working with composite unique identifiers](/concepts/components/prisma-client/working-with-fields/working-with-composite-ids-and-constraints) to learn how to interact with a composite unique constraints in Prisma Client. From b408b6e0e41514795b6034c50d7f1c32c0f02208 Mon Sep 17 00:00:00 2001 From: Nikolas Date: Thu, 23 Nov 2023 17:07:47 +0100 Subject: [PATCH 6/7] Update content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids-and-constraints.mdx --- .../300-working-with-composite-ids-and-constraints.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids-and-constraints.mdx b/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids-and-constraints.mdx index d16cc9e24f..ede6855ea2 100644 --- a/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids-and-constraints.mdx +++ b/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids-and-constraints.mdx @@ -44,7 +44,7 @@ model Like { } ``` -Querying for record from the `Like` table would yield results that look like the following: +Querying for records from the `Like` table would yield results that look like the following: ```json { From 3c4fcf5883ae4f50520b1c083549a1d2ddafa648 Mon Sep 17 00:00:00 2001 From: Nikolas Date: Thu, 23 Nov 2023 17:11:34 +0100 Subject: [PATCH 7/7] Update content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids-and-constraints.mdx --- .../300-working-with-composite-ids-and-constraints.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids-and-constraints.mdx b/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids-and-constraints.mdx index ede6855ea2..3d2f160012 100644 --- a/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids-and-constraints.mdx +++ b/content/200-concepts/100-components/02-prisma-client/051-working-with-fields/300-working-with-composite-ids-and-constraints.mdx @@ -44,7 +44,7 @@ model Like { } ``` -Querying for records from the `Like` table would yield results that look like the following: +Querying for records from the `Like` table (e.g. using `prisma.like.findMany()`) would return objects that look as follows: ```json {