im using mongoclient and im sure that I have connection to the database
const client = new MongoClient(uri);
const datatbaseslist = client.db().admin().listDatabases();
datatbaseslist.databases.forEach(db => {
console.log($db.name)
});
I saw that code in a video of the mongodb and its not working. thanks
I have tried looking for other versions to that line
const datatbaseslist = client.db().admin().listDatabases();
datatbaseslist.databases.forEach(db => {
console.log($db.name)
});
because im pretty sure that the problem is there.
client.db.admin().listDatabases()ordb.adminCommand( { listDatabases: 1 } )See stackoverflow.com/questions/39748101/…dbin the function parameter but you're using$dbin the console log. Also, it'd help if you share the error you're getting