Sub-Document operations with empty key in path

Hi,
I use Sub-Document operations to patch documents in my couchbase 5.0.1.

Let’s consider that we want to update an existing document with following json:

{
	"prop1": {
		"": { 
			"prop2": "some value"
		}
	}
}

Please notice that there is a empty string as a key.

If I update document using path “prop1”:

asyncBucket.mutateIn(id).upsertDocument(true) //
				.upsert("prop1", mapWithEmptyKey)

then it finishes successfully so the key with empty string is stored properly to database.

But if I try to use empty key in path then I receive error SUBDOC_PATH_INVALID. Examples of paths:

"prop1.``"
"prop1.``.prop2"

It is a bit inconsistent.

Is it possible to use Sub-Document api with “empty” keys? Is it a special notation for that case (other than putting value in double-backticks (``))?

Empty key is not valid JSON.

According to standard ECMA-404 (http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf, https://www.json.org/) the empty string is a valid json value.

@vsr1
any update on that issue?

It seems it is possible to create JSON document using regular API, but sub-doc API is forbidding updating keys with empty String as key in path.

In case of usage sub-doc API

asyncBucket.mutateIn('documentId').upsertDocument(true) //
				.upsert("prop1.``.anotherProperty", "someValue")

I’m receiving

Caused by: com.couchbase.client.java.error.subdoc.PathInvalidException: Path prop1.``.anotherProperty ends in an array index in documentId, expected dictionary
	at com.couchbase.client.java.subdoc.AsyncMutateInBuilder$4.call(AsyncMutateInBuilder.java:1399)

When creating document using

asyncBucket.upsert(jsonDocument)

I’m able to save values with empty keys

It might be limitation at present.
As far as N1QL is concern you can track via MB-46420