Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

380
Vistas
how can insert array consisting of multiple objects using sequelize and node?

In below block line of code i want to insert an array of multiple object. but it's not working.

let Bookarray = [{author:"john matt", BookName:"Beauty of Nature"},
{author:"Mick Foley", BookName:"Have A Nice Day"},
{author:"Kevin Sullivan.", BookName:"WWE 50"},
{author:"Brian Shields And Dean Miller", BookName:"35 Years Of Wrestlemania"},
{author:"Mick Foley", BookName:"Foley Is Good"},
]
 
let InsertObj = await BooksDetails.create(Bookarray);

What should i do?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

For an array containing multiples objects use bulkCreate.

let InsertObj = await BooksDetails.bulkCreate(Bookarray);
about 4 years ago · Juan Pablo Isaza Denunciar

0

i don't know for certain but I imagine

Promise.all( Bookarray.map(BooksDetails.create) )

Will do individual inserts. I bet there is a way to insert multiple records that would be more efficient.

Do what @ijaz recommends

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda