Series : MongoDB for Oracle DBA pt 1: Introduction

If you have worked in any sort of Enterprise big or small, most likely you have worked on a Relational Database Management Systems (RDBMS). They have been around for so long that we have taken the relational databases for granted. Relational in RDBMS stands for the relation which exists in a group of objects contained in a abstraction called Schema. A Schema contains tables of Rows and Columns. This has been the defacto way of storing data for the last 40 years since RDBMS have been around. The big vendors in this market today are Oracle, Microsoft, IBM, Teradata, SAP etc.
But with the advent of the Internet, Social media and Web 2.0 companies like Google, Facebook, Twitter, Linkedin etc a new sort of challenge for data arised. Data was no longer a neat structure of rows and columns. The data was now unstructured and being generated in volumes unsuitable to be handled by the old workhorses of traditional enterprise technology. To address these new challenges a new breed of databases had to be designed.
NOSQL databases, deriving their name from their USP that normal SQL queries don’t work or aren’t required anymore. These new databases were designed to address the challenges of the new age world.  The SQL query engine was replaced by data retrieval and inserting API’s. Big Data, real-time capability and ability to scale-out to tens of thousands of servers  across data centers sitting in different continents made it attractive for the HyperScale web companies.
One of the leading companies driving this NOSQL revolution has been a database called MongoDB. MongoDB lacks any of the traditional ACID compliance capabilities of an RDBMS, but it makes up for those in terms of massive scale-out capabilities and sharding of data across thousands of nodes. Though MongoDB is not the only NOSQL database in the market; there are many like Cassandra, CouchDB, Redis etc but it is certainly the leading in the white Noise of  NOSQL databases. It has even launched an IPO recently .
MongoDB is a Key-Value Store unlike a traditional DB storage engine, it is document oriented and stores the data in the form of JSON documents. Tables are called Collections, Rows are called Documents, Columns are called Fields and Primary Key is the unique ID assigned to each Document (Rows).  It is a Schemaless database which gives developers a lot of freedom with how they design and evolve their data models.
Example of a Key Value pair Document
Below is Example from MongoDB’s website
Capture
The Fields are name,age,status,groups and each has an associated value. Also a unique value (key) is assigned to each document. Look at the below example :

{
"_id" : ObjectId("59edd3bfa95893611d8ba674"),
"address" : {
"building" : "2780",
"coord" : [
-73.98241999999999,
40.579505
],
"street" : "Stillwell Avenue",
"zipcode" : "11224"
},
"borough" : "Brooklyn",
"cuisine" : "American",
"grades" : [
{
"date" : ISODate("2014-06-10T00:00:00Z"),
"grade" : "A",
"score" : 5
},
{
"date" : ISODate("2013-06-05T00:00:00Z"),
"grade" : "A",
"score" : 7
},
{
"date" : ISODate("2012-04-13T00:00:00Z"),
"grade" : "A",
"score" : 12
},
{
"date" : ISODate("2011-10-12T00:00:00Z"),
"grade" : "A",
"score" : 12
}
],
"name" : "Riviera Caterer",
"restaurant_id" : "40356018"
}

If you see the first line it has a field called _id  line , it is a unique hexadecimal value assigned to the document. It globally identifies the document in the entire collection of data. It is similar to a Primary Key in a Relational database.
Other features of Mongo DB are

  1. Indexing – It supports a  wide array of indexing viz. Single, Compound, Geo-Spatial, Text and Hashed indexes
  2. MapReduce-  Supports MapReduce algorithms for Data aggregation purpose
  3. Stored JavaScript –  Instead of PL/SQL procedures or Stored Procedures you have Javascript fucntions and their values on the server side.
  4. High Availability and Sharding of Data across cluster of computers

In the Second Part of this Series we will Install MongoDB on a CentOS 7 Server, create a Database and import a Collection and do some basic data retrieval.
So keep watching this space for more….

Category: DatabaseUncategorized

Tags:

Leave a Reply

Article by: Shadab Mohammad