I have defined different roles, one of them allow the specific user to read only one collection. There are many different collections but only one can be readen for this user.
Now when he connects, I want to list all collections he can read.
In C# with mongo driver there is a possibility to list the collections, but the function return an error if the rights to read are wrong.
this is where i am blocked into the code:
var database = client.GetDatabase(DatabaseName);
foreach (BsonDocument namecollection in database.ListCollectionsAsync().Result.ToListAsync<BsonDocument>().Result)
{
string name = namecollection["name"].AsString;
allcollectionNames.Add(name);
}
with the shell I founded a function
use someDbName
db.getCollectionInfos( { authorizedCollections : true } )