Answers for "mongodb list db"

8

show collections in mongodb

db.getCollectionNames()
Posted by: Guest on June-08-2020
9

mongodb show database command linux

show databases
show dbs
Posted by: Guest on May-29-2020
0

list all collections in the MongoDB shell

JavaScript (shell):
db.getCollectionNames()

Node.js:
db.listCollections()
Posted by: Guest on July-19-2020
4

mongo db show datbae

show dbs
Posted by: Guest on July-08-2020
0

List mongo databases

using System;
using MongoDB.Driver;
using MongoDB.Bson;

namespace SimpleEx
{
    class Program
    {
        static void Main(string[] args)
        {
            var dbClient = new MongoClient("mongodb://127.0.0.1:27017");
            var dbList = dbClient.ListDatabases().ToList();

            Console.WriteLine("The list of databases are:");

            foreach (var item in dbList)
            {
                Console.WriteLine(item);
            }
        }
    }
}
Posted by: Guest on October-13-2021

Browse Popular Code Answers by Language