Skip to main content

Posts

Showing posts from March, 2022

MongoDB to Couchbase for developers: Part 4: Data Modeling

"To Embed or Not to Embed. That is the Question."    Hamlet Data modeling is a well defined and mature field in relational database systems. The model provides a consistent framework for application developers to add and manipulate the data. Everything is great until you need to change. This lack of schema flexibility was a key trigger NoSQL database systems.   As we've learned before , both MongoDB and Couchbase are JSON based document database.   JSON gives the developers the schema flexibility; the indexes,  collections, query engine provide access paths to this data;  the developer uses MQL in MongoDB and N1QL in Couchbase to query this data.  Let's compare the modeling methods in Couchbase. Note: T his article is short because the modeling options are similar. That's a good thing. Some differences in modeling options, access methods and optimizations are highlighted below. Query processing on JSON Comparison of modeling options and featu...

MongoDB to Couchbase for Developers. Part 3: Data Types

  In the article on MongoDB and Couchbase   database objects , we saw the mapping from databases to buckets, collections to collections, documents to documents and  field to fields. The data itself is stored within these fields. The {"field": "value"} is commonly called key-value pairs. Every key has a value and the value is the data. This value self describes the data under  BSON or JSON definition in MongoDB and Couchbase. MongoDB uses BSON, Couchbase uses JSON -- both are document oriented and JSON based. Couchbase uses JSON exactly, MongoDB uses extended JSON called BSON,  binary JSON . As part of data remodeling, while moving from the relational model to the JSON model, you’ll have to consider the data type mapping. In Oracle, you’ll have to create and declare the types of each column explicitly before you load the data or write queries. In Couchbase, you simply conform to JSON syntax and the data type interpretation is automatic and implicit. Here’s the ov...