Alex Vilchis
10/19/2022, 4:55 PMcreateMany
? Something like this:
const result = await prisma.payment.createMany({
data: [...]
});
const createdPayments = await prisma.payment.findMany({
where: {
id: {
in: result.ids, // THIS IS NOT POSSIBLE
},
},
});
Any possible workarounds?Takeo Kusama
10/19/2022, 5:31 PMconst result = await prisma.create({
include: {
children: true,
},
data: {
children: {
createMany: {
data: [...]
}
}
}
})
const ids = result.children.map(v => v.id) // This should be possible
Alex Vilchis
10/19/2022, 5:40 PMTakeo Kusama
10/19/2022, 5:47 PM@prisma/client
lib as long as I know (Not clearly, I previous tried to find and reached this code written by rust for any programming language).
Maybe you can use this, too.
https://github.com/paralleldrive/cuidNurul
10/20/2022, 7:04 AMcreateMany
here: #8131
If you could add a 👍 to the request then it would help our product team in prioritising it.
Also, here’s a workaround which you can use meanwhile.Takeo Kusama
10/20/2022, 11:22 AMcreateMany
batch insert? (Sorry, there is as I expected, written in the thread’s alternatives.)Nurul
10/21/2022, 4:00 PMcreateMany
also does batch inserts so the behaviour would be the same. I was just providing an alternative way of achieving the same thing. 👍