Preserve JSON documents for indexing

Description

The way we wrote the CacheBox provider, developers cannot store JSON and index if via Couchbase. If you pass in this JSON string:

The actual Couchbase document is this:

As you can see, the meta characters in the JSON have been escaped so it is just a regular string now which means you can't index any of it's keys like doc.DATA.foo.

To accomplish this, add two new methods to the Couchbase CacheBox provider, getJSON() and setJSON().

setJSON() will not do the normal serialization, but will expect either a JSON document as a string, or a complex value that can be serialized as JSON via the built-in CFML JSON functions. In either case, merge the JSON document with the CacheBox metadata so it is stored as actual JSON and can be indexed by the Couchbase server.

getJSON() will look at the type in the metadata and return the document as it was input-- either as a string or as an object.

Fixed

Assignee

Luis Majano

Reporter

Brad Wood

Labels

None

Components

Priority

Major
Configure