Deserialize Javascript Date on get


I’m saving a document which has javascript Date values, and wish to get it back the same way.

Found a way to achieve this using plain Javascript, by using the second parameter of JSON.parse. JSON.parse(stringDocument, converterFunction).

To achieve this, I need the document as string, but the “bucket.get” returns it already deserialized.
Is there any way to disable the deserialization, without doing stringify + parse?


Hey @adrian.c.petrescu,

It looks like what you are looking for is our transcoder methods. These allow you to intercept the data received from Couchbase and perform your own kind of encoding/decoding on them.

Cheers, Brett


Thanks Brett.

What is the default Encoder, in case I only wish to override the Decoder?

Cheers, Adrian