Newsletters




The Ins and Outs of Data Modeling in NoSQL


Many developers are familiar with the relational way to model data but may not be as familiar with modeling data in a document database. To explore the issues associated with planning, modeling, and maintaining data using a document database, Couchbase recently hosted a DBTA webcast featuring Couchbase lead developer advocate Mathew Revell.

With relational databases, users are accustomed to being able to ask any question that they want.  “A document database takes a slightly different approach,” Revell explained. “It gives us a library of answers.”

Rather than having all of the data all in one location, in a key-value store, data is stored more than once because users won’t need to ask the data infinite types of questions; they will just need to ask a certain set of questions of it.

When discussing embedded versus referred data in comparing relational to a document-based model, the document-based model is much simpler than relational, Revell said.  For example, if there were an e-commerce order in a relational database, all of the information would be separate but linked. In a document database, all of the pertinent information would be stored on a single document.

The time to embed the data is when speed trumps all else, said Revell. Data should be referred if consistency is a priority or the data has large growth potential.

One of the most important aspects of working with a key-value database is the design of the key. There are three broad ways to build a key: human readable/deterministic, computer generated/random, and compound, which is a computer-generated key with a deterministic portion.

N1QL is a query language developed by Couchbase for finding data in its document-oriented database, Couchbase Server. N1QL allows users to choose which elements of information are returned at the top level. This is useful because it reduces the need to write complex parsing logic within the application, client side, and front-end frameworks, said Revell.

To view a replay of this webinar and learn more about the three main things developers need to know about modeling data in a document database: document design, key design, and querying, go here.


Related Articles

Shortly after the explosion of non-relational databases, around 2009, it became apparent that rather than being part of the problem, SQL would instead continue to be part of the solution. If the new wave of database systems excluded the vast population of SQL-literate professionals, then their uptake in the business world would be impeded. Furthermore, a whole generation of business intelligence tools use SQL as the common way of translating user information requests into database queries. Nowhere was the drive toward SQL adoption more clear than in the case of Hadoop.

Posted September 23, 2015

Sponsors