Skip to content

Commit a683b8f

Browse files
committed
correct createManyAndReturn docs. Resolves DA-2937. Resolves #6746.
1 parent 389c943 commit a683b8f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

content/200-orm/200-prisma-client/100-queries/037-relation-queries.mdx

+3-3
Original file line numberDiff line numberDiff line change
@@ -726,14 +726,14 @@ const categories = await prisma.category.createManyAndReturn({
726726
const posts = await prisma.post.createManyAndReturn({
727727
data: [{
728728
title: "Funniest moments in 2024",
729-
categoryId: categories[0].id
729+
categoryId: categories.filter(category => category.name === 'Fun')!.id
730730
}, {
731731
title: "Linux or macOS — what's better?",
732-
categoryId: categories[1].id
732+
categoryId: categories.filter(category => category.name === 'Technology')!.id
733733
},
734734
{
735735
title: "Who will win the next soccer championship?",
736-
categoryId: categories[2].id
736+
categoryId: categories.filter(category => category.name === 'Sports')!.id
737737
}]
738738
});
739739
```

content/200-orm/500-reference/050-prisma-client-reference.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -1274,6 +1274,7 @@ This feature is available in Prisma ORM version 5.14.0 and later for PostgreSQL,
12741274
#### Remarks
12751275

12761276
- The `skipDuplicates` option is not supported by SQLite.
1277+
- Note that the order of elements returned by `createManyAndReturn` is not guaranteed.
12771278
- You **cannot** create or connect relations by using nested `create`, `createMany`, `connect`, `connectOrCreate` queries inside a top-level `createManyAndReturn()` query. See here for a [workaround](/orm/prisma-client/queries/relation-queries#using-nested-createmany).
12781279
- When relations are included via `include`, a separate query is generated per relation.
12791280
- `relationLoadStrategy: join` is not supported.

0 commit comments

Comments
 (0)