Expiry time setup in SYNC gw function

Hi Team,
we wanted to create a function in sync-gw to set the expiry time when the data comes from sync-gw. CB document says we can use expiry function but how do we set it if the days are 90 days? is it like expiry(“7776000”) or some other way to do it.

Also we want to make sure if a document already has expiry time we don’t want to overwrite it- 2way sync- data coming from couchbase document update.


Follow instructions in the docs to se t expiry time. There are couple of formats supported (ISO-8601 and unix timestamp or time internal)

I presume that TTL is set during doc creation. So check if this is a doc creation (i.e. no oldDoc) and only set TTL in that case. That way updates to existing docs will not trigger a TTL change.

yes, i was able to make it work. Thanks