Theo's Typesafe CultTTC
Theo's Typesafe Cult3y ago
33 replies
fotoflo

Prisma CreateMany with a relation (connect)

Hi everyone, in Prisma is there a way to createMany with relation - using connect i assume?

Basically this a million times:

I read the documentation and there doesn't seem to be "nested createMany" but i think that's not that im doing (or is it? seems like this is too common an operation to not have a create-many)...

    const result = await prisma.posts.create({
      data: {
        user: {
          connect: {
            id: user.id,
          },
        },
        ...postData,
      },
    });
Was this page helpful?