How can I query for deleted documents

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?

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.

aren’t deleted documents being updated on a replication?

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.

1 Like

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

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.

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?

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

Thank you