Sub-Document operations with empty key in path


#1

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 (``))?


#2

Empty key is not valid JSON.


#3

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.