Hello Guys, How are you all? Hope You all Are Fine. Today I am just trying to connect my MongoDB database and I am facing the following error MongoParseError: options useCreateIndex useFindAndModify are not supported in MongoDB. So Here I am Explain to you all the possible solutions here.
Without wasting your time, Let’s start This Article to Solve This Error.
How MongoParseError: options useCreateIndex useFindAndModify are not supported Error Occurs ?
Today I am just trying to connect my MongoDB database and I am facing the following error.
MongoParseError: options useCreateIndex useFindAndModify are not supported
Here is my connection code.
mongoose.connect(MONGODB_URL, {
useCreatendex: true,
useFindAndModify: false,
useNewUrlParser: true,
useUnifiedTopology: true
}, err => {
console.log(err)
})
How To Solve MongoParseError: options useCreateIndex useFindAndModify are not supported Error ?
- How To Solve MongoParseError: options useCreateIndex useFindAndModify are not supported Error?
To Solve MongoParseError: options useCreateIndex useFindAndModify are not supported Error Here in Mongoose 6.0 useNewUrlParser, useUnifiedTopology, useFindAndModify, and useCreateIndex are no longer supported options. So that just remove that option. and again try to connect as same like below. If you still want to use Options then Just downgrade your Mongoose below the 6.0 version because in Mongoose 6.0 useNewUrlParser, useUnifiedTopology, useFindAndModify, and useCreateIndex are no longer supported options
- MongoParseError: options useCreateIndex useFindAndModify are not supported
To Solve MongoParseError: options useCreateIndex useFindAndModify are not supported Error Here in Mongoose 6.0 useNewUrlParser, useUnifiedTopology, useFindAndModify, and useCreateIndex are no longer supported options. So that just remove that option. and again try to connect as same like below. If you still want to use Options then Just downgrade your Mongoose below the 6.0 version because in Mongoose 6.0 useNewUrlParser, useUnifiedTopology, useFindAndModify, and useCreateIndex are no longer supported options
Solution 1: Remove options
Here in Mongoose 6.0 useNewUrlParser, useUnifiedTopology, useFindAndModify, and useCreateIndex are no longer supported options. So that just remove that option. and again try to connect as same like below.
Mongoose.connect(
MONGODB_URL,
async(err)=>{
if(err) throw err;
console.log("conncted to db")
}
)
Solution 2: Downgrade to below 6.0
If you still want to use Options then Just downgrade your Mongoose below the 6.0 version because in Mongoose 6.0 useNewUrlParser, useUnifiedTopology, useFindAndModify, and useCreateIndex are no longer supported options
Summery
It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?
Also, Read