As of now, the only way i have worked with newer versions of CouchBase, is through a memcached Client. I use Erlang as the
With respect to Cyprien, your question does have a real answer besides "don't use Couchbase."
Memcache allows many more data types than CouchDB. Specifically, you can Memcache an empty string, the string "{", the string "0", or the string "{}". Only the last one is a valid JSON object that you can use as a CouchDB document. AFAIK the way that Couchbase works is that if a string that you SET or ADD is the JSON representation of a valid CouchDB document, it stores it as a CouchDB document, otherwise it stores it as an attachment. [zIt's a design decision that I don't agree with (they could have just inserted a $value
key into the CouchDB document) but it kind of makes sense given that you could be passing very large objects, actual attachments, over the protocol interface.] Regardless, the "$att_reason": "invalid_json"
is your hint that this is happening.
The upcoming version of Couchbase, 2.0, now in developer preview, exposes almost all of the CouchDB functionality, except for Couch Apps (which are irrelevant if you're using Erlang anyways). So if you want to use that, you'll want to pass JSON of objects over the Memcache interface, but note that then you lose Memcache's atomic shortcuts (you'd need to do a compare-and-swap, which requires an extra network hop).