我正在使用 Couchbase lite 1.0 beta2 从 couchbase 服务器获取和复制数据。在我的例子中,如果从服务器中删除了一个文档,我无法在 android 应用程序中检查它是否从服务器中删除了本地已经存在的文档。在复制器方法中,它只返回更改的文档或新添加的文档。
我尝试使用“document.isDeleted()”,但它总是返回 false。
那么,我怎样才能检查一个文档是否从服务器上被删除了呢?
最佳答案
已删除的文档使用特殊属性 _deleted: true
来指示已删除的文档。因此可以构建一个 View 来索引这些文档。请务必专门使用此属性,而不是简单地删除文档。
这是 couchbase 文档中关于墓碑的内容:
Tombstoning
The reason that tombstone revisions exist is so that deletes can be sync'd to other databases. If revisions were simply deleted with a naive approach, then there would be no easy way to sync up with other databases that contained the revision.
关于android - 了解 Couchbase lite android 中已删除的文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22017350/