Hi all,
I am learning to develop with Mongo driver in C#. I have restricted a user the access to some collections into the database. How can I get the collection names where he can access-> in C# and in the Shell?
the problem is :
var database = client.GetDatabase(DatabaseName);
foreach (BsonDocument namecollection in database.ListCollectionsAsync().Result.ToListAsync<BsonDocument>().Result)
{
string name = namecollection["name"].AsString;
allcollectionNames.Add(name);
}
Here the code crash if it encounters a collection where the user doesn’t have right to access