Hi everybody in a previous post ( ListCollections with autorizedcollection ) I asked how to retrieve the name of the collections available in MongoDb'database. Finally the solution is much easier as expected and is :
var db = mongoUser.GetDatabase(databaseName);
var command = new CommandDocument { { "listCollections", 1 }, { "authorizedCollections", true }, {"nameOnly", true }};
var result = db.RunCommand<BsonDocument>(command);
the problem is I am not used to work with BsonDocument. I could cast the "result" into a BsonDocument or onto a string and then cut until I found the name of the solution. But it is the wrong way. Could someone help me for this case ?