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

142
Views
HasMany association coming wrong with "raw" and "nest" as true

Maybe it is a bug in sequelize, I just opened an issue there.

click here to see the code

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

0

I suppose raw option makes Sequelize to return plain query results without grouping them (that's why it's called "raw"). So that means that if you have two child records for each main record then you'll end up with N*2 objects returned by Sequelize.
If you wish to get plain objects instead of Sequelize model instances just call get({ plain: true}) for each of model instances:

const cart = await Cart.findOne({
...
})
const plainCart = cart.get({ plain: true})
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!