I've watched multiple tutorials on how to connect mongodb with node.js I've created a free account on mongodb.com, set a user name and a password, created a database, added an IP address on 0.0.0.0/0
on vsCode I've installed all necessary packages
and here is my code
const express = require('express');
const mongoose = require('mongoose');
const app = express();
const uri = "mongodb+srv://user_db:mypassword@cluster0.3mf9jav.mongodb.net/myDataBase?retryWrites=true&w=majority";
async function connect(){
try{
await mongoose.connect(uri)
console.log("connected")
} catch(error){
console.log(error)
}
}
connect();
app.listen(3000,()=>console.log("server started"));
The server start but I have no message from mongodb, no errors just nothing happened. I've tried multiple times to rewrite the code, created multiple account from mongodb but always the same result, nothing happened.