CouchDB文档复制(更新文档的特定属性)

时间:2015-05-04 13:03:52

标签: couchdb

我有一个复制问题,我需要你的帮助。在couchDb复制中,我想以这样的方式复制,即在Couchdb复制期间我想为某种目的重置/更新文档的某些特定属性然后这些编辑过的文档应保存在复制的数据库中,而不会影响原始文档。例如: 名为Student的文档,包含属性id,name,class等。 我希望以重置/更新其名称和类的方式复制此文档。 你能告诉我怎样才能实现它。 感谢。

1 个答案:

答案 0 :(得分:0)

You can't update docs during the replication.

But you can exclude docs from being replicated with the help of a CouchDB filter (e.g. preventing all docs with a revision higher then 1 from being replicated).

If you want to have multiple versions of the same dataset (e.g. to have dataset revisions) - i use the term "dataset" instead of "doc" to clearly express that not the internal CouchDB doc revision handling is involved - you have to store them as separated docs that have all a unique id and a reference property like original: "UUID_of_the_original".

you can't use the CouchDB doc revision handling for that purpose (thats what many people think when they see the _rev property in the docs)