Sub-Document Methods

Hey Couchbase Team,

I’ve got an issue and question about the sub-documents methods.

  1. MutateIn (upsert) seems to work correctly, but when using LookupIn (Get / Exists) the OpStatus(…) in IDocumentFragment, the last element always has a status of NONE (-1 enum).

To see if it was related to the last position, I tried the following:

var lookupBuilder = bucket.LookupIn(docKey);
for (var i = range.Item1; i < range.Item2; i++)
var key = fileKeys[i++];
lookupBuilder.Get(key, SubdocPathFlags.None, SubdocDocFlags.UpsertDocument);
var lookupResult = lookupBuilder.Execute();

Note: Even with this, the “success” indicator for the entire lookup is “false”.

  1. After hitting the limit first hand, I found the “Limit” section in the documentation that mentions that 16 is the maximum operations that can be done at a time. Is there a way to increase this limit? (I’m assuming not) Is this to avoid a performance issue, or is there another reason this limit is present?

Hi @xulane

  1. I’ll take a look at LookupIn.Get/Exists to see if I can see what’s going on with the operation codes. I don’t think you need the SubdocDocFlags.UpsertDocument flag though, that may be messing with it.

  2. The limit cannot be changed and was set by the KV team for performance reasons when editing > 16 paths within the same document is likely to be better done with a get, edit locally and replace the document as a whole.