Skip to main content

NoSQL - An Introduction

"Not Only SQL" generally known as  NoSQL is a database system that provides simple lightweight mechanism for storage and retrieval of data.  NoSQL has become much popular in the last few years. The database arose alongside major Internet companies such as Google, Yahoo, Facebook and Amazon because all these companies has to deal with a large amount of data  and  when a relational database grows out of one server, it is no longer that easy to use. In other words, they don't scale out very well in a distributed system. So all these big sites store the data in distributed systems for several reasons. It could be that the data doesn't fit on one server, or there are requirements for high availability

Some advantages of NoSQL databases are:
  • They don't have a fixed schema as traditional RDMS have.
  • They don't write normal SQL statements against the database, but instead use an API to get the data they need.
  • The NoSQL databases can usually scale across different physical servers easily without needing to know which server the data you are looking for is on.
  •  Highly optimized for retrieval and appending operations and often offer little functionality beyond record storage.
  • NoSQL has a distributed, fault-tolerant architecture
  • The NoSQL data stores use looser consistency models to achieve horizontal scaling and higher availability.

NoSQL databases are categorized mainly into four according to the way they store the data as Key/value stores databases, Bigtable inspired databases, Document store databases
and Graph databases.

The central concept of a document store is the notion of a document. While each document-oriented database implementation differs, in general, they all assume that documents encapsulate and encode data in some standard formats or encodings. 


Graph database is designed for data whose relations are well represented as a graph (elements interconnected with an undetermined number of relations between them). The kind of data could be social relations, public transport links, road maps or network topologies.


Key–value stores allow the application to store its data in a schema-less way. The data could be stored in a datatype of a programming language or an object. Because of this, there is no need for a fixed data mode.

This blog post also covers some basics of a NoSQL database MongoDB.


MongoDB is an open-source, document-oriented database designed for ease of 

development and scaling.The main features of MongoDb are flexibility, power, speed, and
ease of use. A MongoDB deployment hosts a number of databases. A database holds a set of collections. A collection holds a set of documents. A document is a set of key-value pairs. Although MongoDB supports a “standalone” or single-instance operation, production MongoDB deployments are distributed by default. Replica sets provide high performance replication with automated failover, while sharded clusters make it possible to partition large data sets over many machines transparently to the users.

The database can be installed in your system following the instructions. The blog hereafter covers some basics of MongoDB. After we have successfully installed the database, mongo can be started by typing
mongo in the command prompt. Some commands used in the MonoDB operations are given below:

dbAfter starting the mongo shell your session will use the test database for context, by default. At any time issue the above operation at the mongo to report the current database.

show dbs -  Display the list of databases from the mongo shell.

use mydb  -  Switch to a new database named mydb.

help - At any point you can access help for the mango shell using thisoperation.

db.things.insert()- Insert documents into the collection things.When you insert the first document, the mangod will create both the database and the things collection.

show collections - Displays the available collections in the database.

db.things.find() - Finds the documents in the collection. The documents to be found can be specified through arguments of the find function. The cursor of the MongoDB displays only the first 20 output documents. it command is used to display the rest of the documents.

These are some basic commands used in MongoDB. For further details please refer here.


Comments

Popular posts from this blog

Backbone.js - An Introduction

Backbone.js is a lightweight JavaScript library that adds structure to your client-side code.  Developers commonly use libraries like Backbone.js to create single-page applications (SPAs).  What is a Single-Page-Application? A single page Web App is a website that attempts to recreate the experience of a native desktop or mobile application. On a Single Page Web App you are less likely to see page refreshes, the browser navigation within the app is often overridden and  there will usually be some offline capabilities. To a user their interaction with a Single Page Web App will be almost identical to how they interact with a full native application. Backbone has many advantages over other js frameworks. Backbone is mature, popular, and has a number  of plugins and extensions available that build upon it. It has been used to create non-trivial applications by companies such as Disqus, Walmart, SoundCloud and LinkedIn. Backbone organizes its whole code under t...

Elements of Programming in Scheme

A powerful programming language provides a framework to interpret our ideas of processes. It generally combines small procedures to complex ones. Usually there are three steps to accomplish this. primitive expressions , which represent the simplest entities the language is concerned with, means of combination , by which compound elements are built from simpler ones, and means of abstraction , by which compound elements can be named and manipulated as units. Some very basic ideas in manipulating with the data are given below. Expressions   A very simple expression is a number. Simple expressions are combined to form complex ones. For example:                   (+ 2  3  4) is an expression where + is the operation and 2,3,4 are the oparents. The expression can be made more complex by combining simple expressions as given below:              ...

Abstraction Using Higher Order Procedures

Procedures are, in effect, abstractions that describe compound operations on numbers independent of the particular numbers. Yet even in numerical processing we will be severely limited in our ability to create abstractions if we are restricted to procedures whose parameters must be numbers. Often the same programming pattern will be used with a number of different procedures. To express such patterns as concepts, we will need to construct procedures that can accept procedures as arguments or return procedures as values. Procedures as arguments Procedures are often used as the arguments of an another procedure. This provides a higher level of abstraction in programming. For example consider a procedure to find out the sum of squares of numbers between a range. The procedures inc and square are used as the arguments of the procedure sum, which is generalised as follows.                 (define (inc...