We have an existing object in Couchbase. It is JSON. Attempts to retrieve the document as a
JsonDocument work fine.
The Couchbase UI shows the document fine. Attempts to retrieve the document as a
LegacyDocument returns success, but the content is null.
Attempts to query the document as a
StringDocument returns the following error:
com.couchbase.client.java.error.TranscodingException: Flags (0x2000001) indicate non-String document for id XYZ, could not decode.
My understanding of LegacyDocument is that it should always work, yet it doesn’t and I’d certainly expect to be able to read a JSON document as a String.
This problem occurs in Java (v2.2.5). In .NET (v2.2.6), I’m able to read in the document as a String.
EDIT: Debugging the source code and it seems to blow up in the LegacyTranscoder in
deserialize() where it logs
5:36:43.717 [cb-computations-4] WARN c.c.c.j.transcoder.LegacyTranscoder - Caught IOException decoding %d bytes of data java.io.StreamCorruptedException: invalid stream header: 7B226576
-There’s a bug in that logging statement, no %d population.
EDIT: I would’ve thought that retrieving the document as
BinaryDocument would allow me to just have the data, but nope.