Ask HN: What Database Would You Use for User Defined Data?
I&#x27;m working on a system where each user defines a strongly typed definition of data they can store, consisting of classes with specified fields. Embedded classes are also supported. My first instinct was that NoSQL would be perfect for this, because we wouldn&#x27;t have to worry about keeping track of changes to the data types. Because MongoDB only supports sharding based on indexes, I thought it would make sense to put everything in a single collection, sharded by user_id. However, MongoDB only supports 64 indexes per collection. Ideally we should be able to dynamically create an arbitrary number of indexes based on common user query patterns. Now I am thinking that maybe using Postgres&#x27;s JSONB type on a single table similarly sharded would make more sense. Or maybe I&#x27;m going about this the wrong way, and we should just create a regular Postgres table per user taking advantage of the fact that data definitions are strongly typed? I&#x27;m not sure how sharding would work though.<p>Has anyone dealed with something similar, and has some advice?