enter image description heremy current version of node is ‘v13.14.0’ because i have windows 7 OS,and its saying that your version is incompatible with this mongodb driver ,i also try to connect the ‘v4.0’ mongodb driver but its giving me same error
i am tring to create simple demo app for practicing mongodb database
var express = require('express');
var router = express.Router();
var mongoose=require('mongoose');
/* GET users listing. */
mongoose.connect("mongodb+srv://athrude:[email protected]/?retryWrites=true&w=majority");
const userSchema= mongoose.Schema({
name:String,
age:Number
})
module.exports=mongoose.model("user",userSchema);
2
Answers
The error you’re encountering is because your Node.js version is incompatible with the MongoDB driver you’re trying to use. MongoDB version 4.0 driver requires at least Node version 12.x or higher. You’ll need to update Node.js to a version that’s both compatible with the MongoDB driver and supported on Windows 7.
You should also check your code for any syntax errors, as indicated by the error message. Look at the files and line numbers referenced in the error stack to find the exact issue.