Hi there,
We have a multi-tenant database, with a particular collection sharded by orgId. We want to add a remindAt date to some of the documents (< 1%), and have a sparse index on it.
This collection already has multiple indexes on it, always including the orgId.
Queries that run on the remindAt field won't include the orgId in the selector. Do I need to include the orgId in the sparse index on remindAt or does mongo allow me to leave it off?
Whether I add the orgId field or not, all queries that run on the remindAt field that aren't orgId specific need to be distributed out to every shard, correct? If that's the case, it may be better not to add the orgID if mongo allows that.
Another way of modeling this may be to keep the remindAt dates in a different collection, but I doubt the benefits are worthwhile.
Cheers,
Tim.