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
Getter/Setter Mongoose FeathersJS on get or find

When using getter or setter in a mongoose schema, it is only call on create. It's the same for a transform function in toJSON or toObject in schema options. On a get or find there is no console.log()

const schema = new Schema({
    imageId: {
      type: String,
      get: (v) => {
        console.log('Here');
        return v;
      }
    },
  }, {
    timestamps: true
    toJSON: {
      transform: (doc, ret, options) => {
        console.log('Here too');
      }
    }
    }
  });

Do you know how make them work on get and find ?

Thanks

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

0

When using Mongoose model properties the lean service option needs to be set to false.

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!