gpt4 book ai didi

nosql - 如何防止 CouchDB 中的压缩?

转载 作者:行者123 更新时间:2023-12-01 09:20:09 24 4
gpt4 key购买 nike

如果我需要永久保存所有修订,如何防止 CouchDB 中的压缩?我可以禁用此功能吗?

最佳答案

除非您完全理解其中的含义,否则通过禁用压缩来永久保存修订并不是一个好主意。如果您需要存储文档的历史版本,您完全可以在 CouchDB 上构建它,但您应该明确地这样做。

有一篇博文here其中描述了许多不同的方法。如果您不需要索引历史文档,我建议在保存时将每个修订作为附件存储。从那篇博文中,

when the document is loaded from the CouchDB server, the string representation is saved before being parsed into JSON. Later, when the document is saved, the string representation is attached as a new binary attachment, with the corresponding rev as it’s name, and a content type of application/json. This way any CouchDB library can just open the stored rev, and see it as a normal document.

This means that each time the document is updated, the client will also store the previous version as an attachment to the latest version. At any time, a user can load any of the old versions.

关于nosql - 如何防止 CouchDB 中的压缩?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20820041/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com