Chapter 3. Document-based Database Design
Couchbase Server is strictly a document database, and as we’ve seen you store data into the database by using a document ID and the corresponding document data. That data can be in any format, and indeed there is nothing to stop you using a serialized object or stream of raw bytes and storing and retrieving this information.
With that in mind, you will get the best benefits out of Couchbase and the clustered architecture if you use Couchbase to store and use the data that is most frequently used and updated by your application. The low latency on reads and writes that Couchbase Server provides makes it ideal for the highly interactive portions of your application, rather than as a generalised data store for both active and historical information.
Modelling data in documents and Couchbase Server is about understanding how to store and reference different types of information. For example, some data is easily identifiable as a simple field. Other data is more usable and accessible as an array or object style within the JSON structure. We’ll start by looking at JSON before building a sample model based on our recipe database.
JSON Overview
JSON is a lightweight, easily parsed, cross-platform data representation format. There are a multitude of libraries and tools designed to help developers work efficiently with data represented in JSON format, on every platform and every conceivable language and application framework, including, of course, ...
Get Developing with Couchbase Server now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.