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

344
Views
Option "useFindAndModify" is not supported

I'm trying to connect to my database using mongoose and in my console is displaying ' option usefindandmodify is not supproted '. I'm using mongoose 6.0.0

this is my code

  mongoose.connect(constants.CONNECTION_URL,
     { useNewUrlParser: true,
       useUnifiedTopology: true, 
       useFindAndModify: false 
     })
.then(() => app.listen(constants.PORT, () => console.log(`Server Running on Port ${constants.PORT}`)))
.catch((error) => console.log(error.message));

mongoose.Promise = global.Promise;

can someone suggest me how can I get rid of that? is written with white if matters neither green nor red, white.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Starting with Mongoose version 6, you should not specify that as an option. It will be handled automatically.

This issue is explained here.

useNewUrlParser, useUnifiedTopology, useFindAndModify, and useCreateIndex are no longer supported options. Mongoose 6 always behaves as if useNewUrlParser, useUnifiedTopology, and useCreateIndex are true, and useFindAndModify is false. Please remove these options from your code.

over 4 years ago · Santiago Trujillo Report

0

i got this error too , so i fixed that like this
i guess useNewUrlParser, useUnifiedTopology, useFindAndModify are no longer available

mongoose.connect(constants.CONNECTION_URL).then(() => app.listen(constants.PORT, () => console.log(`Server Running on Port ${constants.PORT}`)))
.catch((error) => console.log(error.message));

mongoose.Promise = global.Promise;

mongoose.connect(CONNECTION_URL) .then(() => app.listen(PORT, () => console.log(Server running on port ${PORT})) ).catch((error) => console.log(error.message));
over 4 years ago · Santiago Trujillo Report

0

New version of Mongoose don't support useFindAndModify, you don't have to write it in your code, Mongoose by default takes useFindAndModify as false.

just remove useFindAndModify from your code.

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!