Security in a single CouchDB can only be set up to do either:
- Everyone can read/write everything (admin party)
- Everyone can read, some can write
- Some can read everything, and those same people can write everything
So in the very common situation where you want user data to be private, the current best practice is to give every user a database. This sounds nuts at first, but it turns out that databases are cheap in CouchDB; Cloudant boasts that 100k databases in a single Couch is not uncommon (source).
However, actually implementing one database per user is not open-and-shut. You need a separate server process outside of CouchDB to handle it. Everyone has their own solution; here are some popular ones:
Update: the CouchDB docker image now has a built-in couch-per-user
support, making this much easier to implement: https://hub.docker.com/r/klaemo/couchdb/
@gastonmorixe Thanks for your tip! I'm gonna try this out later, and see what happens. Have you tried this in a production environment, such as AWS or Cloudant or something similar?
Finally the implementation of the database-per-user using just the native Couch roles system was far more easy than I believed. The only cuestionable thing is that I had to implement a server-side endpoint to manage this configuration when a new user/db is created, but it's fine for my requirements.
Thanks for your help!