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

157
Views
When the err part of optional callback in mongoose queries will be executed?

For nearly all mongoose queries, the provided callback function will be called with two arguments in the node callback pattern - callback(err, results) as stated in the documentation.

I want to know when the err part of the callback will be executed.

Suppose below query is executing in a loop and in case of callback err, I am coming out of loop. Now, if it will not find any document with the mentioned conditions in any one iteration of loop, then err part will be executed or it will be executed only in case of some run time error only. I mean the next iteration will continue or not??

Model.findOneAndUpdate([conditions], [update], [options], [callback])

Thanks in advance.

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!