Doing
_db.GetCollection<TEntity>(typeof(TEntity).Name).AsQueryable().Count()
results in
Command aggregate failed: not authorized on DB to execute command { aggregate: "Customer", pipeline: [ { $sort:
{ lastname: 1, companyShortTitle: 1 }}, { $group: { _id: 1, __result:
{ $sum: 1 }} } ], cursor: {} }.
The user that uses the conncection has dbAdmin, dbOwner and readWrite roles.