P
Prisma•5mo ago
toasty

is it possible to have a connect clause within a createMany operation?

i need to do a createMany: { data : { item: connect [ ... as I have many hundreds of thousands of records
1 Reply
RaphaelEtim
RaphaelEtim•5mo ago
Hi @toasty 👋 Prisma Client does not support the createMany operation with nested writes, which includes the connect operation for relations. You can refer to the documentation for more details. Instead, you can modify the payload to pass in the foreign key id directly instead of using connect. You can take a look at this Github Discussion and this other discussion
GitHub
createMany() & relations : is connect possible? · prisma prisma · D...
Question As stated in the the documentation, it is not possible to CREATE relations with createMany(). The documentation does not state the behaviour for connecting to existing records. The same pa...
GitHub
CreateMany while connecting to many · prisma prisma · Discussion #2...
Question Assuming I have a schema like this (Simplified for explanation): model Post { title String categories Category[] id String @id @default(uuid()) } model Category { name String @unique posts...
Relation queries (Concepts) | Prisma Documentation
Prisma Client provides convenient queries for working with relations, such as a fluent API, nested writes (transactions), nested reads and relation filters.
Want results from more Discord servers?
Add your server