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

391
Views
how to update database with mongoose

I am trying to update MongoDB database with mongoose

Works but I can't get a call back with new data

 Templates.updateOne((req.query, req.body))

does not work

Templates.updateOne(req.query, req.body, { new: true }, (err, data) => {
      console.log("just call back", data);
    })

the data that is coming from req.query

 {title: "Hello World"}

the data that is coming from req.body

 {_ref: "your ref}

I am hoping to be able to update with callback and new data to console.log

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

0

According to the doc, Document.prototype.updateOne() does not accept {new:true} (it is a native MongoDB command, I believe), but Model.findOneAndUpdate() does.

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!