How can I query for deleted documents

query

#1

I have a hashtable of objects in memory and I am trying to remove objects that have been deleted from the db from it.
I cant seem to create a livequery for _deleted documents as q.setIncludeDeleted(true); seems to work only for all document query.
Is there a way to do it that is not so resource intensive as all document query?


#2

Don’t use a query. Just observe databaseChanged notifications, then look at the DatabaseChanged object(s) and act appropriately on the ones that represent deletions.


#3

aren’t deleted documents being updated on a replication?


#4

I think the deleted documents are required for replication, if you are connecting to a Sync Gateway.

It leaves the tombstones until the DB is compacted, I think.


#5

I don’t understand the question; can you restate it in more detail?


#6

I am deleting the doc using REST. and when I do getExistingDocument from the couchbase lite java SDK I see the old revision that doesn’t have the deleted flag as expected.


#7

Did you check that the REST call succeeded?

What are the revision IDs (_rev property) of the deleted revision the REST call created, and the old revision you get from the Java API?


#8

I cant seam to reproduce that state.
Anyway changes listener was a good solution.

Thank you