Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

307
Views
¿Cómo se implementa .upsertMany() en Prisma ORM?

Prisma ORM tiene una implementación del método actualizar o crear upsert() y un grupo de solicitudes masivas ,
pero no existe tal cosa como .upsertMany() , es decir, "crear o actualizar registros existentes" de forma masiva.

¿Cuál es la mejor manera de implementar dicho método utilizando Prisma ORM ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Prisma no admite upsertMany forma nativa.

Hay una solicitud de función para proporcionar el método upsertMany .

A partir de ahora, el mejor enfoque sería recorrer los datos e invocar upsert en el ciclo junto con el uso $transaction .

Ejemplo:

 const collection = await prisma.$transaction( userData.map(cur => prisma.cur.upsert({ where: { id: cur.id }, update: {}, create: { id: cur.id }, }) ) )

Aquí hay una referencia a la API $transaction que debería ser útil.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!