Lookup type GETDOC unknown


The lookupIn().get() method seems to be unsupported.
The following test:

Bucket bucket = ...

Results in:

java.lang.UnsupportedOperationException: Lookup type GETDOC unknown

	at com.couchbase.client.java.subdoc.AsyncLookupInBuilder.doSingleLookup(AsyncLookupInBuilder.java:312)
	at com.couchbase.client.java.subdoc.AsyncLookupInBuilder.execute(AsyncLookupInBuilder.java:147)
	at com.couchbase.client.java.subdoc.LookupInBuilder.execute(LookupInBuilder.java:153)

Is it something that will be implemented in the future?

The main use case for using lookupIn().get() is to get only the specified fields when user specified them (get(fields)) or get() the entire document when no fields are specified.
It is of course possible to get the entire document using different API calls (such as Bucket.get()), but method result type is different which makes writing code to support both scenarios more complicated.


Yes, it’ll be part of extensions to the Sub-document API in Spock (5.0) release.

lookupIn.get() has been added to allow fetching the document body along with one or more Extended Attributes, but that will be more costly than a straight Bucket.get(), as the server doesn’t have to perform any JSON sub-document manipulation to perform it.

I would recommend using Bucket.get() if you want the entirety of a document, not least because lookupIn.get() isn’t supported in the currently released version :slight_smile:

Hi @adam.dyga,

As @drigby mentioned, this is supported in the 5.0 server release. Both full document get and set through subdoc builders are marked as experimental API. I’ve created a ticket to update the api docs to include supported server versions.