how to fix Mongoose Deprecation Warning "the strictQuery"
when i start build my backend server i get this deprecation warning, but its show that im connected to database. i just search the solution in youtube and re-create again but its still didnt work. this is my code ...
in server.js
const dotenv = require('dotenv');
const mongoose = require('mongoose');
const app = express();
dotenv.config();
mongoose
.connect(process.env.MONGODB_URI)
.then(() => {
console.log('connected to db');
})
.catch((err) => {
console.log(err.message);
});
const port = process.env.PORT || 5000;
app.listen(port, () => {
console.log(`serve at http://localhost:${port}`);
});
in package.json
{
"name": "backend",
"version": "1.0.0",
"description": "backend",
"main": "server.js",
"scripts": {
"start": "node server",
"dev": "nodemon server"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"dotenv": "^16.0.3",
"express": "^4.18.2",
"mongoose": "^6.8.0"
},
"devDependencies": {
"nodemon": "^2.0.20"
}
}
and this is the Mongoose Deprecation Warning enter image description here
its show :
(node:8392) [MONGOOSE] DeprecationWarning: Mongoose: the `strictQuery` o` if you want to prepare for this change. Or use `mongoose.set('strictQu
(Use `node --trace-deprecation ...` to show where the warning was create
serve at http://localhost:5500
connected to db
i dont know where to fix this error because i think its come from my node_modules. how can i fix this warning? is this warning gonna impact when im gonna connect my frontend to backend or its gonna impact when im gonna deploy? sorry im just beginner.
i start build my backend server i get this deprecation warning, but its show that im connected to database. i just want fix the warning. i re-create this backend again but its still didnt work, its still show the deprecation warning
Comments
Post a Comment