Book Image

Learning Couchbase

By : Henry Potsangbam
Book Image

Learning Couchbase

By: Henry Potsangbam

Overview of this book

This book achieves its goal by taking up an end-to-end development structure, right from understanding NOSQL document design to implementing full fledged eCommerce application design using Couchbase as a backend. Starting with the architecture of Couchbase to get you up and running, this book quickly takes you through designing a NoSQL document and implementing highly scalable applications using Java API. You will then be introduced to document design and get to know the various ways to administer Couchbase. Followed by this, learn to store documents using bucket. Moving on, you will then learn to store, retrieve and delete documents using smart client base on Java API. You will then retrieve documents using SQL like syntax call N1QL. Next, you will learn how to write map reduce base views. Finally, you will configure XDCR for disaster recovery and implement an eCommerce application using Couchbase.
Table of Contents (12 chapters)
Index

Understanding JSON and non JSON data


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...