Is it good practice to give each CouchDB user a separate database?

前端 未结 4 894
情话喂你
情话喂你 2021-02-15 00:39

I have a bit of conceptual question regarding the structure of users and their documents.

Is it a good practice to give each user within CouchDB their own databa

4条回答
  •  被撕碎了的回忆
    2021-02-15 01:06

    It’s rather common scenario to create CouchDB bucket (DB) for each user. Although there are some drawbacks:

    • You must keep ddocs in sync in each user bucket, so deployment of ddoc changes across multiple buckets may become a real adventure.
    • If docs are shared between users in some way, you get doc and viewindex dupes in each bucket.
    • You must block _info requests to avoid user list leak (or you must name buckets using hashes).
    • In any case, you need some proxy in front of Couch to create and prepare a new bucket on user registration.
    • You better protect Couch from running out of capacity when it receives to many requests – it also requires proxy.

    Per-doc read ACL can be implemented using _list functions, but this approach has some drawbacks and it also requires a proxy, at least a web-server, in front of CouchDB. See CouchDb read authentication using lists for more details.

    Also you can try to play with CoverCouch which implements a full per-doc read ACL, keeping original CouchDB API untouched, but it’s in very early beta.

提交回复
热议问题