When I am updating the document from N1QL the expiry function called inside the sync function of the sync gateway doesn’t work and doesnt set the expiry time of the document. But If I update the document through sync gateway the expiry is set and document get deleted at the correct time.
Do note that the change done by N1QL does reflect when the get operation is done. So it means import is done properly. Only doubt I am having is about the sync function.
I am using CBS 5.1.1 and SG 2.0.
Following is my sync gateway config :slight_smile :
{
“server”: “http://...,..***.:8091",
“pool”: “default”,
“bucket”: “bucketname”,
“username”: “bucketname”,
“password”: “password”,
“name”: “username”,
“sync”:`function(doc, oldDoc)
{
if(doc.type)
{
if(doc.type == “GuestAdditionalInformation” || doc.type == “BoardingAdditionalInformation” || doc.type == “Multimedia”)
{
if(doc.lastModifiedDate)
{
var dttimeStamp = new Date(doc.lastModifiedDate).getTime();
dttimeStamp=dttimeStamp+(15 * 24 * 3600 * 1000);
expiry(new Date(dttimeStamp).toISOString());
}
else
{
expiry(“3600”);
}
}
}
if(doc.ExpiryDateEpoch)
{
var dtexpiryDateEpoch = new Date(doc.ExpiryDateEpoch).getTime();
expiry(new Date(dtexpiryDateEpoch).toISOString());
}
if(doc.channels)
channel(doc.channels);
}`,
“users”: {
“GUEST”: {
“name”: “”,
“all_channels”: null,
“disabled”: true
},
“Xuser”: {
“name”: “Xuser”,
“admin_channels”: [
“”
],
“all_channels”: null,
“password”: “”
},
“Yuser”: {
“name”: “Yuser”,
“admin_channels”: [
“”
],
“all_channels”: null,
“password”: "”
}
},
“import_docs”: “continuous”,
“cache”: {
“enable_star_channel”: null,
“channel_cache_max_length”: 100000,
“channel_cache_min_length”: 50,
“channel_cache_expiry”: 600
},
“rev_cache_size”: 200000,
“unsupported”: {
“user_views”: {},
“oidc_test_provider”: {}
},
“enable_shared_bucket_access”: true,
“session_cookie_name”: “”
}
CC :- @househippo, @adamf , @traun