Updating metadata with Couchbase eventing

Hi, I cannot find anything related on document. I just simply want to modify metadata (or extended attributes) and add new field for tracking if eventing OnUpdate function worked for source document before. Couchbase version 7.

Added picture, want to modify this area with eventing, not from any sdk, application etc.

Example(It won’t work):

function OnUpdate(doc, meta) {
var query = {"id":meta.id};
var result =  couchbase.get(mockProduct, query);
result_meta = result.meta
result_meta.xattrs.customfield = "some-custom-field"
couchbase.upsert(mockProduct, result_meta, result.doc)
}

like this. Is it possible?
Screen Shot 2023-03-21 at 00.36.27

Hi @aras,

Unfortunately Eventing Functions can not modify any attribute of a document’s meta object (with the exception of an expiration date) or a document’s xattrs.

If this is important please notify your sales team and ask that a CBSE be opened this will help prioritise your particular request as part of the future enhancement request backlog.

Best

Jon Strabala
Principal Product Manager - Server‌

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.