Search code examples
node.jsmongodbmongoskin

Is there a way to list collections with mongoskin?


I already have an established database connection. I need to list the names of the collections in the database. Is it possible?


Solution

  • To show collections into database from mongo shell :

    db.getCollectionNames()
    

    So to show collection in mongoskin try that

    var collections = db.collections();
    collections.each(function(err, collection) {
        console.log(collection);
    });
    

    according to this link Mongoskin Tutorial