I am trying to connect to Atlas MongoDB with the following URI (provided by mongodb connection string )
    module.exports = {
        mongoURI:'mongodb+srv://<user>:<password>@cluster0-un6sk.mongodb.net/test? 
    retryWrites=true'
    };
    //connect to mongoose
    mongoose
        .connect(db)
        .then( ()=>console.log('mongoDB connected'))
        .catch(err => console.log(err));
I get the following error :
{ MongoNetworkError: connection 3 to cluster0-shard-00-00-un6sk.mongodb.net:27017 closed
    at TLSSocket.<anonymous> (C:\Users\KARTIT Ismail\Desktop\devconnector\node_modules\mongodb-core\lib\connection\connection.js:352:9)
    at Object.onceWrapper (events.js:273:13)
    at TLSSocket.emit (events.js:182:13)
    at _handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:386:7)
  name: 'MongoNetworkError',
  errorLabels: [ 'TransientTransactionError' ],
  [Symbol(mongoErrorContextSymbol)]: {} }
 
    
 
     
     
     
    