Skip to content

Commit

Permalink
add visual for nested create (#6139)
Browse files Browse the repository at this point in the history
* add visual for nested create

* Optimised images with calibre/image-actions

* fix file path

* move visual

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jon Harrell <[email protected]>
  • Loading branch information
3 people authored Nov 5, 2024
1 parent 51058d2 commit 8c96bc7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ const user = await prisma.user.findFirst({
</cmdResult>
</CodeWithResult>



### Select specific fields of included relations

You can use a nested `select` to choose a subset of fields of relations to return. For example, the following query returns the user's `name` and the `title` of each related post:
Expand Down Expand Up @@ -636,6 +638,10 @@ const result = await prisma.user.create({
</cmdResult>
</CodeWithResult>

Here's a visual representation of how a nested create operation can write to several tables in the database as once:

![](/img/orm/nested-create.png)

#### Using nested `createMany`

The following query uses a nested [`createMany`](/orm/reference/prisma-client-reference#create-1) to create:
Expand Down
Binary file added static/img/orm/nested-create.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8c96bc7

Please sign in to comment.