We use Mongo to store multitenant data in our application. For example we have data from a company lets call it “Baker” and another company let’s call it “Smith”. We want to be able to filter the data per company (we currently have thousands of companies) by passing a filter {companyIdentifier:"baker"}
or {companyIdentifier:"smith"}
depending on which company is viewing the data. We dynamically add companies all the time so it should work with any company we add . For example we might set up “Tayler” at which point any data should automatically be filtered {companyIdentifier:"tayler"}
. I see there is a way to set up authenticated access and apply a filter on a per user basis. This wont work for us because we wont be setting up a user per company (I think there are limits on how many users you can set up anyway). Any guidance is appreciated.
Hi @Dan_Cumings -
The Injected Filters feature that you discovered is the way to do this. You don’t actually need to have the users defined anywhere to use this feature; you just need a way of issuing signed JWT tokens that specify the company name as a claim. The exact way of doing this will depend on the tech stack you use, but you can look at out Custom JWT sample as a starting point.
Tom
1 Like
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.