I have written the code to connect the database with node js with no mistakes and tried to execute the code but the error I have got is unable to understand, I have tried every solution that has been posted on youtube and google but none of them have helped me
I also reinstalled the MongoDB several times still getting the same problem
const {MongoClient}=require('mongodb');
const url='mongodb://localhost:27017';
const database='local'
const client=new MongoClient(url);
async function getData()
{
let result=await client.connect();
let db=result.db(database);
let collection=db.collection('startup_log');
let response=await collection.find({}).toArray();
console.log(response);
}
getData();
‘mongo’ is not recognized as an internal or external command,
operable program or batch file.
I am getting this when I have tried to check the version of MongoDB through cmd even the path in the system variable is clear
can anyone give the solution for it
