Expiry is not working in syncgateway sync function


#1

We tried to implement expiry function on a sync gateway which is backed by couch base. While posting the data we are getting following error.

The sync function is as shown below:-
function(doc, oldDoc)
{ expiry(doc.ExpiryDateEpoch); }

I even tried with expiry(“2018-07-06T17:00:00+01:00”) shown at https://developer.couchbase.com/documentation/mobile/1.4/guides/sync-gateway/sync-function-api-guide/index.html#expiry

but this too gave the same error. below is the error. If somebody got a working piece of sync function having expiry then please help.

Sync fn exception: ReferenceError: expiry is not defined;
– db.(*Database).getChannelsAndAccess() at crud.go:911
–> 500 Exception in JS sync function (28.8 ms)

CC:- @househippo

Regards
Pankaj Sharma


#2

Which version of Sync Gateway are you using?


#3

It looks like that feature wasn’t added until Sync Gateway 2.0:

https://github.com/couchbase/sync_gateway/issues/3015 (check the milestone)


#4

@pankaj.sharma,

SG 2.0 is GA today :slight_smile:


#5

I am excited for SG 2.0 but the problem is we cant move to that as the production date is very near. We want to have this in 1.4.1. Please let us know what help I can be for the same.


#6

@pankaj.sharma

I don’t know how much engineering resource it would take to back port.

Check out the release notes of SG 1.5.1 & 2.0.0
It might be worth upgrading.

If its a blocker for you try opening a support ticket at: https://support.couchbase.com


#7

We’re not adding new features to 1.x products … only high priority bug-fixes.


#8

No issues we have used 2.0 and its working fine.