MongoDB: Getting the list of all databases?

Andrey picture Andrey · May 24, 2011 · Viewed 16.7k times · Source

How do I list all databases for a connection using Mongo C# Driver?

Answer

Robert Stam picture Robert Stam · May 24, 2011

Very easily:

var server = MongoServer.Create("mongodb://localhost/?safe=true");
var databaseNames = server.GetDatabaseNames();