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

184
Views
Cómo obtener datos en el mismo orden que el orden de los elementos en la matriz usando Sequelize

Por ejemplo, si se pasa la matriz surveyIdsArr con los siguientes elementos.

 surveyIdsArr = [ 'ac9d491d-9998-4866-956d-9d3107aa341d', 'f71cfa71-ad1a-40dc-ad19-7f799fef0a31', 'a9606715-c865-4f99-9afc-48b79af77caa', 'f22c221d-2052-45af-a1ba-9774ac524a1c', '33c47cdb-8a66-45a8-a8ff-cc60de6ce9fc' ]

Luego, cómo obtener los datos en el mismo orden que los elementos en la matriz

En este momento estoy obteniendo elementos 33c47cdb-8a66-45a8-a8ff-cc60de6ce9fc , 22c221d-2052-45af-a1ba-9774ac524a1c , f71cfa71-ad1a-40dc-ad19-7f799fef0a31 y así

Estoy usando Sequelize como ORM

El siguiente es el código para obtener los datos.

 let fetchedSurveys = await Survey.findAndCountAll({ where: { id: { [Op.in]: surveyIdsArr, }, }, include: [ { model: User, as: "owner", }, { model: Tag, as: "tags", attributes: ["id", "tagName"], }, ], // helpful in lazy fetching offset: offset, limit: limit, distinct: true, col: "id", });
about 4 years ago · Juan Pablo Isaza
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!