LabSubd/Subd/GoingToMongo/Program.cs

15 lines
436 B
C#

// See https://aka.ms/new-console-template for more information
using MongoDB;
using MongoDB.Driver;
using System.Data;
MongoClient context = MongoDateBase.getInstance().client;
foreach (var datab in context.ListDatabaseNames().ToList())
{
Console.WriteLine(datab);
}
IMongoDatabase logistic = context.GetDatabase("logistic");
foreach(var collection in logistic.ListCollections().ToList())
{
Console.WriteLine(collection);
}