As of now, the only way i have worked with newer versions of CouchBase, is through a memcached Client. I use Erlang as the programming language and so i had grabbed myself an Erlang Memcached Client. I noticed that this client serialises and de-serialises erlang terms (both Key and Value) by converting them from and to binary using erlang:term_to_binary/1 and erlang:binary_to_term/1
when sending and receiving data from memcached.
While setting up CouchBase, we are asked to choose either memcached buckets or CouchBase buckets (vbuckets). Now, i chose CouchBase (because i needed persistence). I started interacting with the setup using the erlang memcached client and it is okay, i save erlang terms and get back erlang terms from the database. However, the problems begin here:
1. Because of data serialization, objects are received as attachments.Even if sent as JSON From Erlang, they are sent as binary data which makes no meaning to CouchBase (or Memcached ?)
{ "_id": "mykey", "_rev": "1-000010fb1a2b02ef0000000d59960000", "$flags": 38489, "$expiration": 0, "$att_reason": "invalid_json", "_attachments": { "value": { "content_type": "application/content-stream", "revpos": 2, "digest": "md5-n3mJhf2kKVQtkIunIbCJZQ==", "length": 13, "stub": true } } }
2. As a result of this, this data cannot be searched, manipulated through CouchDB views. The only way to get the data is by "Key", however nested an object may be. With original Couch DB, we could write Advanced Views, Map reduce to search and manipulate JSON data in the database e.t.c
3. Hence, we cannot clearly use things like: Couch Apps and Design Documents with Couch Base as we used to do with Couch DB, because, these features are meant for JSON data processing within Couch.
Questions
1. I understand that CouchBase is looking at a different approach from CouchDB, however, as a developer i feel like a lot has been taken away from us. No more Couch Apps, Design Docs, Views, e.t.c ?
2. Probably, i am getting something wrong here, can some one please show me how i can still do all this with Couch Base as i did with original Couch DB ?
3. Is there any other way to insert, read or update data in Couch Base 1.8 and above, (using erlang) other than an Erlang memcached client ? This is because, there is data serialization which makes this data useless to other technologies within the same project as they may not be able to decode Erlang data Structures
4. In a multi-language project where we have PHP Developers, C++, Erlang, Ruby e.t.c. working with the same Couch Base instance (Database), with the data serialization, how are we supposed to access and understand data across all technologies ?
Someone assist point out the changes from CouchDB to Couch Base, explain why the new Couch Base is so tied up to Memcached to a point where by we have to use memcached clients to speak with CouchBase. Also, if there is another Erlang-to-CouchBase SDK which can help me speak JSON (and NOT serialized data) from and to Couch Base, i wish to lay my hands on it.
** EDIT **
Assume the following: CouchBase x86_64 1.8.0 and Erlang OTP R15B. I need to work with JSON data in Couch Base so that in a large multi-language project, our applications operate the same data set without having serialization challenges. Thank you