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

320
Views
I am getting this error: Type '(err: Error) => void' has no properties in common with type 'QueryOptions'.ts(2559) and I don't know what's the cause

Here is my "delete user" route:

Here is my "delete user" route:

app.post("/deleteuser", async (req, res) => {
 const { id } = req?.body;
 await User.findByIdAndDelete(id, (err: Error) => {
  if (err) throw err;
 });
 res.send("success");
});
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

[SOLVED]

app.post("/deleteuser", async (req, res) => {
  const { _id } = req?.body;
  try {
    await User.findByIdAndDelete(_id);
    res.send('success');
  } catch (err) {
    res.status(500).json({
    message: err.message
    });
  }
});
over 4 years ago · Santiago Trujillo 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!