Generally I don’t like using time as the input into a decision. But in this case I’m considering it.
In the sync function on Sync Gateway I’d like to accept document updates if the object was created not too long ago. If the object was created more than 24hrs ago, I’d like to reject further updates. Essentially freezing the document.
Can I do this in the sync function ?
Are these Javascript functions available:
Date.now()
(new Date()).getTime()
Generally I have never found a definitive section in docs.couchbase.com that defines which Javascript functions are available, or which JavaScript runtime version is running in Sync Gateway (e.g. trial and error told me that the keyword ‘let’ is not available)