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

200
Views
Cómo pasar datos de candidatos a mangosta pre('validar')

Cuando estoy ejecutando este código:

 const mongoose = require('mongoose'); const ASchema = mongoose.Schema({ test: { type: String }, }); ASchema.pre('validate', function (next) { console.log('pre validate') console.log(this); next(); }); ASchema.pre('save', function (next) { console.log('pre save, not run') next(); }); const AModel = mongoose.model('test', ASchema); const a = new AModel({ test: { value: '1' } }); await a.save();

Estoy obteniendo como salida:

 pre validate { _id: new ObjectId("61c9f38e3f8f3d783d0e83c1") }

esperaba obtener:

 pre validate { _id: new ObjectId("61c9f38e3f8f3d783d0e83c1"), test: { value: '1' } }

Quiero obtener el campo de prueba en la función pre('validar') incluso si no es válido para poder procesarlo. Es eso posible ?

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!