Skip to content

list databases #9048

@its-dibo

Description

@its-dibo

I am trying to list all databases useing mongodb and mongoose.
with mongodb it successesed, but with mogoose I got an error.

mongoose.connect(uri).then( connection=>{
    let Admin = mongoose.mongo.Admin;
    let admin = new Admin(connection.db);
    console.log({ admin });  //s: { db: undefined, topology: undefined, promiseLibrary: undefined }
    console.log({ dbs: admin.listDatabases() });
})

but I got the following error:

Cannot read property 's' of undefined

I'm using the last version of mongoose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    new featureThis change adds new functionality, like a new method or class

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions