Let's try to understand the representation of a document in Couchbase. A document in Couchbase can be represented by JSON as well as by non JSON binary data. We have already explored the JSON format in an earlier chapter, and now you might be wondering why I am trying to explain it further. When you design a document for storage and retrieval from Couchbase, you will be working extensively in the JSON format. Hence, understanding it in detail is very important when it comes to designing documents for performance and efficiency.
JSON is a text format that is completely language-independent and a lightweight data interchange format. It is built on two structures, as follows:
A collection of name and value pairs: Depending on the type of language, it can be realized as an object, record, dictionary, hash table, keyed list, or associative array
An ordered list of values: This is represented as an array, vector, or list
Its representation is quite similar to that...