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

149
Views
Múltiples inclusiones en una consulta de modelo

perdón por mi inglés. Quiero hacer múltiples asociaciones de inclusión dentro de un findOne usando Sequelize. Cuando lo hago por separado incluye todo funciona perfectamente. Voy a contrastar a continuación lo que funciona y lo que no.

 // that doesn't work const post = await Post.findOne({ where: { post_url: post_url }, include: { // this include dont work association: 'postAuthor', attributes: ['name'], }, include: { association: 'comments', attributes: ['comment'], include: { association: 'commentAuthor', attributes: ['name'] } } });

Pero si hago cada oración por separado, funciona.

 // this work include: { association: 'postAuthor', attributes: ['name'], },

Nuevamente lo siento por los ingleses.

En resumen, necesito hacer que ambas funciones funcionen al mismo tiempo. El include dentro del include funciona perfectamente (commentAuthor In comments).

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

0

 where: { post_url: post_url }, include: [ { association: 'postAuthor', attributes: ['name'] }, { association: 'comments', attributes: ['comment'], include: [{ association: 'commentAuthor', attributes: ['name'] }] } ] });
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!