为每个CouchDB用户提供一个单独的数据库是一种好习惯吗? [英] Is it good practice to give each CouchDB user a separate database?

查看:109
本文介绍了为每个CouchDB用户提供一个单独的数据库是一种好习惯吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对用户及其文档的结构有一些概念性的疑问。

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

为CouchDB中的每个用户提供他们自己的一个好习惯保存文档的数据库?

我已经读过,couchDB可以处理数千个数据库,并且每个用户拥有自己的数据库并不少见。

I have read that couchDB can handle thousands of Databases and that It is not that uncommon for each user to have their database.

原因:

提出此问题的原因是我正在尝试创建一个系统,其中登录用户只能查看自己的文档而无法查看任何其他用户文档。

The reason for asking this question is that I am trying to create a system where a logged in user can only view their own document and can't view any other users document.

任何建议。

提前谢谢。

推荐答案

为每个用户创建CouchDB存储桶(DB)是很常见的情况。虽然存在一些缺点:

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


  • 您必须在每个用户存储桶中保持ddoc同步,因此在多个存储桶中部署ddoc更改可能会变为真正的冒险。

  • 如果以某种方式在用户之间共享文档,则会在每个存储桶中获得doc和viewindex dupes。

  • 您必须阻止 _info 请求避免用户列表泄漏(或者你必须使用哈希命名桶)。

  • 无论如何,你需要在Couch面前创建一些代理来创建并准备一个关于用户注册的新桶。

  • 当收到许多请求时,你最好保护Couch不会耗尽容量 - 它还需要代理。

  • 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.

每个文档读取ACL可以使用 _list 函数实现,但这种方法有一些缺点,它还需要一个CouchDB前面的代理,至少是一个Web服务器。有关详细信息,请参阅使用列表的CouchDb读取身份验证

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.

您也可以尝试使用 CoverCouch 来实现完全按文档读取ACL,保持原始CouchDB API不变,但它处于早期测试阶段。

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.

这篇关于为每个CouchDB用户提供一个单独的数据库是一种好习惯吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆