Sync Gateway - Add new Field in SYNC function

Hi Team,
is it possible to add new field in syncgw function?
we have tried with below, let’s say we want to add field called ($MdfdTmstmp )
doc.$MdfdTmstmp = “2021-06-11”
both are not working? any suggestion on how to do it.


It’s not possible to modify the document via the sync function. You can populate a document timestamp from the client side.
If you need to guarantee the date is correct from Sync Gateway, you can do read-only validation of that field in the sync function by comparing against a var now = new Date();