gpt4 book ai didi

android - 如何在本地删除文档以便服务器在 couches 服务器中保留副本

转载 作者:行者123 更新时间:2023-11-29 10:36:29 24 4
gpt4 key购买 nike

我已经使用 Couchbase Server、Couchbase Lite(iOS 和 Android)和 Couchbase Sync Gateway 成功地实现了一个应用程序。

应用程序中的一个模块每 3 分钟同步一次某些文件。现在,挑战是仅在设备上保留最近 1 周的文档。

但是,Couchbase 服务器应该保留所有文档。

在 Couchbase lite 中删除文档也会导致从服务器中删除。这是 Couchbase 网站的摘录

Deleting a document actually just creates a new revision (informally called a "tombstone") that has the special _deleted property set to true. This ensures that the deletion will replicate to the server, and then to other clients that pull from that database, just like any other document revision.

感谢对此的帮助。

谢谢

最佳答案

您可以使用同步网关的 channel functionality .因此,设备只会同步已分配给名为“上周”的 channel 的文档。您可以将 channel 定义为 sync function查看文档中创建的字段(假设您正在跟踪文档的创建时间)

关于android - 如何在本地删除文档以便服务器在 couches 服务器中保留副本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26687890/

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