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

325
Views
Sequelize getters do not run on model.findall( { raw:true } )

I have a photo attribute in one of my Sequelize models. I have a getter for it.

 photo: {
        type: Sequelize.STRING,
        get: function () {
            if (this.getDataValue("photo"))
                return process.env.IMAGE_PREFIX + this.getDataValue("photo")
            else
                return this.getDataValue("photo")
        }
    },

but when i want to findall records in this model with ({raw:true}) getter doesn't work.

  const categories = await Category.findAll({
            limit: parseInt(limit),
            offset: parseInt(offset),
            raw: true,
            where: {
                title: { [Op.like]: '%' + searchString + '%' }
            }
        });

if i use ({plain:true}) instead , just finds one record.

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

0

Due to newer version of sequelize as documentation itself says:

Getters wont run with instance.get({ raw: true }), use instance.get({ plain: true })

You can read more about it here

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!