Edit Doc In SyncFunction

So we have stringified JSON on our doc. So the doc looks like

{
“stringJson”: “{“stringKey”: “stringValue”}”
}

I’d like to set the parsed property on the doc, to look like

{
“parsedJson”: {
“stringKey”: “stringValue”
}
}

When i try and set properties on the doc during the sync function it doesn’t seem to do anything. Is there a way to set the property in the sync function?

This is very confusing as in the sync function the ‘example’ doc shows the parsed data, but couchbase server doesn’t have the parsed data on the same doc.

1 Like

Hi, you can’t mutate documents using the sync function.

What’s the use-case for stringifying JSON inside a JSON document?