We’re building a kind of an address book as multi-tenant/saas/clould solution. The part about multi-tenancy seems to be clear https://blog.couchbase.com/multi-tenancy-couchbase-server/.
The question is about a feature where each tenant has the ability to define custom fields for contacts (might be tens of fields). The requirement is to be able to provide decent performance for custom queries, even against custom fields. Let’s say that we even expect millions of documents per tenant.
The straightforward approach seems to be defining custom fields as the top or the child level fields inside the main contact document. Partial indexes could be set per tenant per needs. Is there some kind of a negative side-effect of this approach?
The other one is to simulate notorious EAV model from relational databases and “vertically” store custom data in the same field. Usually this approach should be avoided, but not sure, might be something which is optimal for CB?
Or there might be some other optimal solution tailored particularly for CB due to its unique features?