Save OldDoc on Delete CB-Lite 1.4

Looking to archive the last revision of a document before it’s deleted.

We have a system where we are deleteing stuff in couchbase lite, but we to do analytics on the last revision that was not deleted. Instead of querying through all documents and going to their R-1 revision, how would I be able to archive the oldDoc when it get’s deleted?

Is there a way to make requests to other services in sync gateway, or have it save the old doc somewhere else?

Our system uses Couchbase Lite 1.4, and upgrading is not an option. So the most up to date Couchbase Server we can use is 5.1, and Sync Gateway 1.4.

Thanks!

You could use the Eventing service to listen for doc deletes and do the needful.

That would be wonderful!
However, and I should have specified above and I will edit the post, we are using a couchbase lite 1.4, and are unable to upgrade without significant developer work, which we simply don’t have.

From the docs eventing isn’t available in any version before 5.5, and according to the compatibility matrix we can use up to version 5.1.

The version of Couchbase Lite has no (direct) bearing on the version of Couchbase Server. You can use Couchbase Lite 1.4 with Sync Gateway 2.x (its backwards compatible) . Sync Gateway 2.x is compatible with Couchbase Server 5.5

OH that’s awesome!
I was looking at the docs for old sync gateway and was very confused at this link:
https://docs.couchbase.com/couchbase-lite/1.4/index.html

Thank you so much for pointing me in the right direction!