CouchDB versioning strategy

后端 未结 4 515
猫巷女王i
猫巷女王i 2020-12-23 21:44

Would the following be a viable strategy for implementing versioning(using \"example\" as a sample document type):

Have one original document where the type field is

4条回答
  •  自闭症患者
    2020-12-23 22:49

    A strategy for versioning with CouchDB is to NOT ever compact the database which contains the documents for which you need to keep a full history. You could still compact other databases. This simple strategy works today out of the box with an edit conflict resolution strategy.

    Deleting a document could be done by writing a new version with no content but a deleted property set.

    Branches cannot be done this way because the versioning mechanism offers a single thread of revisions.

    Now for the possible future of CouchDB:

    • Today each revision holds a full copy of the document but one could think that optimizations of the CouchDB engine could one day store deltas.
    • It is also possible that in the future CouchDB would offer an API to prevent the compaction of certain document types. This would allow to keep all the documents in the same database. This would be an easy patch to CouchDB.
    • This strategy does enable the management of document branches but considering the nature of CouchDB as a document database, this is something of a reasonable, yet long term, possibility.

提交回复
热议问题