PouchDB 真的会永远保留所有文档修订吗?
Does PouchDB really keep all document revisions forever?
https://pouchdb.com/guides/compact-and-destroy.html 的 PouchDB 文档引起了我的注意:
By default, PouchDB and CouchDB are designed to store all document
revisions forever.
这种行为在我的情况下确实不理想,随着大量文档的编辑,数据库会随着时间的推移变得庞大。因此,我决定使用 https://pouchdb.com/getting-started.html 上可用的 couchdb 自己的任务演示 "getting started" 应用程序对其进行测试。
我的测试是:创建任务,多次编辑它们,然后使用 PouchDB Inspector chrome 扩展在数据库中检查它们。令我惊讶的是,似乎只有最后一次修订被保存在数据库中。如果我没有遗漏什么而且那是真的,那么他们为什么在他们的官方文档上写 "By default, PouchDB and CouchDB are designed to store all document revisions forever." ?我错过了什么吗?
如果你再多读几句,你会看到:
To mitigate this problem, PouchDB offers two recourses: compaction and destruction.
该页面的其余部分解释了如何处理它。
To my surprise, it seems that only the last revision is being saved... Am I missing something?
我不熟悉 Chrome 扩展,但默认情况下 PouchDB 只会显示最新的修订版,除非您明确请求其他修订版。
此外,默认情况下,PouchDB 最多保留每个文档的 1000 个修订版 (configurable with revs_limit
)。这是必要的,以便在与 CouchDB 同步时解决冲突。
如果您从不同步,或者您知道您永远不需要超过 N 次修订来解决冲突,您可以将此设置为较低的数字以节省 space。
https://pouchdb.com/guides/compact-and-destroy.html 的 PouchDB 文档引起了我的注意:
By default, PouchDB and CouchDB are designed to store all document revisions forever.
这种行为在我的情况下确实不理想,随着大量文档的编辑,数据库会随着时间的推移变得庞大。因此,我决定使用 https://pouchdb.com/getting-started.html 上可用的 couchdb 自己的任务演示 "getting started" 应用程序对其进行测试。
我的测试是:创建任务,多次编辑它们,然后使用 PouchDB Inspector chrome 扩展在数据库中检查它们。令我惊讶的是,似乎只有最后一次修订被保存在数据库中。如果我没有遗漏什么而且那是真的,那么他们为什么在他们的官方文档上写 "By default, PouchDB and CouchDB are designed to store all document revisions forever." ?我错过了什么吗?
如果你再多读几句,你会看到:
To mitigate this problem, PouchDB offers two recourses: compaction and destruction.
该页面的其余部分解释了如何处理它。
To my surprise, it seems that only the last revision is being saved... Am I missing something?
我不熟悉 Chrome 扩展,但默认情况下 PouchDB 只会显示最新的修订版,除非您明确请求其他修订版。
此外,默认情况下,PouchDB 最多保留每个文档的 1000 个修订版 (configurable with revs_limit
)。这是必要的,以便在与 CouchDB 同步时解决冲突。
如果您从不同步,或者您知道您永远不需要超过 N 次修订来解决冲突,您可以将此设置为较低的数字以节省 space。