in Prisma is there a way to createMany with a connect?
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 (FWIW my code below wasn't able to be found in documentation either...)
const result = await prisma.posts.create({
data: {
user: {
connect: {
id: user.id,
},
},
...postData,
},
});
Ok I found that this was actually quite simple... just do it as usual insert and include the forign key id.
const result = await prisma.posts.createMany([
{
...postData,
userId,
},
]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With