mguserdev
unread,Oct 29, 2011, 12:17:36 PM10/29/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
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?