I am working on a multi-tenant application in which I am using a
single collection for all tenants and tracking the tenant via a
tenant_id field. All queries will include tenant_id = X as a
condition.
My question is that I've read mongodb can only use a maximum of 1
index per query. So, if an every query I already have tenant_id = X as
a condition, then that means none of my other field's indexes will
ever be used?
EG: Suppose I had a query in which tenant_id = X and foo = bar, if
mongodb is using the index on tenant_id, then I creating an index on
the 'foo' field will never be used?
Is there a best practice to deal with indexing fields in multi-tenant
applications in mongodb?