PouchDB设计文件的复制 [英] PouchDB replication of design documents

查看:66
本文介绍了PouchDB设计文件的复制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Cordova应用程序在应用程序内浏览器中运行PouchDB。每个用户都属于一个团队。对于每个团队,云中都有一个沙发数据库,​​他们都在与本地数据库同步。

I have a Cordova app running PouchDB inside the in-app browser. Each user belongs to a 'team'. For each team, there is a couch database in the cloud that they're all syncing their local pouch with.

我想创建一个设计文档,其中提供了一些信息简单的过滤功能,但我担心该团队的任何用户都将能够创建设计文档的新修订版,从而影响其他每个用户对文档的视图。

I'd like to create a design document that provides some simple filtering functionality, but I'm concerned that any user belonging to that team would be able to create a new revision of the design document and thus affect every other user's view of the documents.

锁定设计文档更新是一种常见的做法吗?这些设计文档通常是在用户之间复制的,还是仅在本地邮袋中创建的,并且以某种方式无法复制到共享的云沙发?

Is it a common practice to lock down updates of design documents? Are these design documents typically replicated between users, or are they created in local pouches only and somehow prevented from replicating to a shared cloud couch?

推荐答案

我对人们的标准建议是从不复制设计文档。

My standard advice to folks is to never replicate design documents. It's just too confusing and security-risky.

因此,在复制时,您可以执行过滤器以排除ID以 _design开头的所有文档。 / 。在客户端,您只需创建所需的任何ddocs,并与服务器同上。

Therefore when you replicate, you can just do a filter to exclude any documents whose IDs start with _design/. On the client side, you just create whatever ddocs you need, and ditto with the server.

另一方面,这并不能阻止恶意用户尝试执行以下操作:覆盖服务器端的设计文档。 (以防您也使用服务器端ddocs。)防止该问题的唯一方法是使用 validate_doc_update 函数,该函数可用于防止非管理员覆盖设计文档。

On the other hand, this doesn't prevent a malicious user from attempting to overwrite design documents on the server-side. (In case you are also using server-side ddocs.) The only way to prevent that is with a validate_doc_update function, which you can use to prevent non-admins from overwriting design docs.

希望有帮助!

这篇关于PouchDB设计文件的复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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