SubDocument mutation fails on some unicode characters

Some unicode characters cause failures when used in subdocument paths. Is it documented anywhere which characters are not allowed? From what I understand from the specs every character should be allowed, provided it is properly escaped.


Example stacktrace:

com.couchbase.client.core.error.CouchbaseException: Unexpected SubDocument response code {"completed":true, "path":"something.`let\\u2019s go!`.something.more","requestId":48470534,"requestType":"SubdocMutateRequest","retried":0,"service":{"bucket":"kahoot","collection":"_default","documentId":"4a3db9d8-653d-4b2a-ad61-b06dbe879b45","errorCode":{"description":"Subdoc: Some (or all) commands failed. Inspect payload for details","name":"SUBDOC_MULTI_PATH_FAILURE"},"opaque":"0x291da3f","scope":"_default","type":"kv","vbucket":951},"status":"SUBDOC_FAILURE","subdocStatus":"PATH_INVALID","timeoutMs":2000,"timings":{"dispatchMicros":142,"encodingMicros":11,"totalDispatchMicros":142,"totalServerMicros":0,"totalMicros":220,"serverMicros":0}}

Java Client v3.4.0, Couchbase 6.6.2 build 9600

Hi Michal. Welcome to the Couchbase Forum.

Those examples all work for me. Do you want to share the failing code?

David collection; // initialized somewhere else
String path = "\\\u200d";
Insert insertSpec = MutateInSpec.insert(path, JsonObject.create()).createPath();
collection.mutateIn("0b59ddfe-7797-4960-9471-fab80bde6e23", List.of(insertSpec));

Does replacing that with ā€œ\u200dā€ solve the issue?

Yes it does help. Does it mean that only json-specific (ascii) characters should be escaped?

I believe the only characters that must be escaped in subdocument path elements are backtick (escape by doubling it) and backslashes (also by doubling them).

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