简体   繁体   English

长沙发/ pouchdb复制是否在子文档级别工作?

[英]Does couchdb/pouchdb replicate work at a sub-document level?

I am using couchdb to store content of courses (text, attachments) that will sync with a mobile app with pouchdb. 我正在使用ouchdb存储课程内容(文本,附件),这些内容将与带有pouchdb的移动应用程序同步。 This content will change from time to time, and I want to use the replication mechanism to send the updated content to the mobile devices. 该内容将不时更改,我想使用复制机制将更新的内容发送到移动设备。

I have two options here: 我在这里有两个选择:

  1. Should I store the whole content of the course in a single document? 我应该将课程的全部内容存储在一个文档中吗? If I do so, will the whole document be transmitted over the network even when just a small part changes? 如果这样做,即使只是一小部分更改,整个文档也会通过网络传输吗?
  2. Should I break the course in smaller documents (eg course > modules > lessons -> content blocks) so that smaller chunks of information are sent over the internet? 我应该将课程分为较小的文档(例如,课程>模块>课程->内容块),以便通过互联网发送较小的信息块吗?

What is the best option? 最好的选择是什么?

For attachments, CouchDB will do sub document updates, PouchDB will not although that is being worked on for PouchDB. 对于附件,CouchDB会进行子文档更新,尽管PouchDB正在处理,但PouchDB不会。

For any of the data not stored in attachments, the rest of the JSON neither do sub document level updates, so every change will transfer the entire JSON across. 对于未存储在附件中的任何数据,其余JSON都不进行子文档级更新,因此每次更改都会在整个JSON范围内进行传输。

If you are looking to minimise the amount of data that gets transferred on changes and are not worried about atomic changes to the course as a whole. 如果您希望最大程度地减少因更改而传输的数据量,并且不必担心整个过程的原子更改。 Then splitting it out into a few documents sounds like a decent idea. 然后将其拆分为几个文档,听起来像是一个不错的主意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM