Prisma ORM · Prisma Client queries

Create related records together

Create a user and their posts in one nested write.

await prisma.user.create({
  data: {
    email: "[email protected]",
    posts: { create: [{ title: "First post" }, { title: "Second post" }] },
  },
});

Official Prisma ORM documentation

More prisma client queries commands

All prisma client queries commands · Prisma ORM cheatsheet

Was this page helpful?