Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning Couchbase

You're reading from  Learning Couchbase

Product type Book
Published in Nov 2015
Publisher
ISBN-13 9781785288593
Pages 248 pages
Edition 1st Edition
Languages
Author (1):
Henry Potsangbam Henry Potsangbam
Profile icon Henry Potsangbam

Table of Contents (12) Chapters

Introduction to Couchbase The Couchbase Administration Interface Storing Documents in Couchbase Using Buckets Designing a Document for Couchbase Introducing Client SDK Retrieving Documents without Keys Using Views Understanding SQL-Like Queries – N1QL Full Text Search Using ElasticSearch Data Replication and Compaction Administration, Tuning, and Monitoring Case Study – An E-Commerce Application Index

Chapter 11. Case Study – An E-Commerce Application

You have come a long way in understanding the various features provided by the Couchbase cluster. In the first chapter, you understood the concepts of NoSQL and the Couchbase architecture. Subsequently, we talked about how to interact with a Couchbase cluster using the admin web UI, CLI, and so on. Then, we talked about storing information in buckets and how to design documents for NoSQL databases. One of the main fundamentals that you need to keep in mind is to think in terms of denormalizing data. After that, we talked about Java client APIs used to interact with Couchbase to perform CRUD operations and retrieve documents using MapReduce programming, views, and N1QL. We also discussed the integration of ElasticSearch with Couchbase to provide full text search capabilities.

In this chapter, you will learn how to use Couchbase as a database for an e-commerce application. We will discuss some data models that pertain to e-commerce applications...

Overview


Let's suppose that we need to develop an application that will sell books online. We have already decided the technologies to be used for it. We will be using Couchbase as a database and Couchbase Java SDK APIs to develop it. Since we are using Couchbase as the backend, we will be designing our data model in terms of documents. As mentioned earlier, it is impossible to discuss and analyze the entire ecosystem of e-commerce in a single chapter; we will discuss only one or two scenarios.

In any typical e-commerce application, you can browse catalogs, search for products, view them, add them to a shopping cart, and order them. You will have modules for customer registration, inventory management, fulfillment management, advertising management, and so on. However, in this chapter we will discuss only the minimal relevant scenarios so that you understand how to apply a NoSQL document design in the Couchbase cluster.

The conceptual model


Let's implement the catalog and order process scenarios for our e-commerce application. In our use case, we will be selling only books on the portal that we are going to design. However, if the business wants to expand later to include other products, there will be enough flexibility in this design.

The data model

Our data model is shown in the preceding figure, this is, the database schema. However, in Couchbase, we don't need to create each domain object as a separate entity; the schema of the information goes along with the document. The data model is explained as follows:

  • Customer: This is a model that a user can browse for a product, which can be bought from our application

  • Cart: This represents the namespace to group products that a customer wants to buy

  • Product: This represents books

  • Category: This groups the books into groups such as programming, databases, and so on

For our use case, a customer can have only one cart. In it, the customer can add multiple products...

Summary


In this chapter, we discussed an e-commerce data model and implemented it using the Java API. Finally, we incorporated many of the concepts we discussed in the earlier chapters. I hope you enjoyed reading this book!

lock icon The rest of the chapter is locked
You have been reading a chapter from
Learning Couchbase
Published in: Nov 2015 Publisher: ISBN-13: 9781785288593
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}