I found this post (Multi-tenanted DB. Strategy for Document ID and authorization) and I'm trying to modify my base repository similar to the first answer or the second answer. I understand both answers are good for RavenDB, however, my backend database is MongoDB and I was wondering if I can implement similar approach for my MongoDB base repository.
Thanks,
Edit1: to be more specific this is the problem I'm trying to solve: currently for authorization we add the TenantID to every query we run against our database/collections. And sometimes developer forget to add the TenantID (so potentially an attacker can have access to other tenant's data). What I want to do is to force add the TenantID to be always as part of queries we run against the DB. similar to what people suggested in the fist and the second answers above.
Update: I found a way, I used Builders < T > to pass what I need to base functions in my BaseRepository and then I add the TenantID to query there. This solved my problem.