1

My connection code is this one

const url = 'mongodb://admin:password@localhost:27017';
const Connected=async()=>{
  
    await MongoClient.connect(url,(err, client) =>{
        assert.equal(null, err);
        console.log("Connected successfully to MongoDb server");
       
    })}

But I want to access a specific database called test an not just a connection to the server.

PS: I tried to add the database name after the connection string but it did not help.

Zeitounator
  • 38,476
  • 7
  • 53
  • 66

0 Answers0