MongoDB Overview


I have started to work with MongoDB so think to start blogging about MongoDB. I will try to write very simple language which will give you great understanding on MongoDB concept to create and deploy a highly scalable and performance-oriented database.
MongoDB is an open-source document database is written in c++, and leading NoSQL database.
MongoDB is a cross-platform, document-oriented database that provides, high performance, high availability, and easy scalability. MongoDB works on the concept of collection and document.
MongoDB OVERVIEW
Database: Database physically contains the collections. Each database gets its own set of files on the file system. A single MongoDB server usually has multiple databases.
Collection: This is equivalent to RDBMS table; basically collection is a group of MongoDB Documents. A collection exists within a single database. Collections do not insist on a schema. Documents within a collection can have different fields. Naturally, all documents in a collection are of similar or related purposes.
Document: Document is a set of key-value pairs. Documents have a dynamic schema. Dynamic schema means that documents in the same collection do not need to have the same set of fields or structure, and common fields in a collection's documents may hold different types of data.


RDBMS
MongoDB
Database
Database
Table
Collection
Tuple/Row
Document
column
Field
Table Join
Embedded Documents
Primary Key
Primary Key (Default key _id provided by MongoDB itself)
Database Server and Client
Mysqld/Oracle
mongod
mysql/sqlplus
mongo

Sample document
Below given example shows the document structure of a blog website which is simply a comma-separated key-value pair

{
   _id: ObjectId(4gf66u875)
   title: 'MongoDB Overview',
   description: 'MongoDB is no sql database',
   by: 'codefari',
   url: 'http://www.codefari.com',
   tags: ['mongodb', 'database', 'NoSQL'],
   likes: 100,
   comments: [  
      {
         user:'user1',
         message: 'My first comment',
         dateCreated: new Date(2015,1,20,2,43),
         like: 0
      },
      {
         user:'user2',
         message: 'My second comments',
         dateCreated: new Date(2015,1,25,7,34),
         like: 5
      }
   ]
}
_id is a 12 bytes hexadecimal number which assures the uniqueness of every document. You can provide _id while inserting the document. If you didn't provide then MongoDB provide a unique id for every document. These 12 bytes first 4 bytes for the current timestamp, next 3 bytes for machine id, next 2 bytes for process id of MongoDB server and remaining 3 bytes are simple incremental value.

1 comment:

  1. brief but nice one !

    few more details in easy way -
    http://www.mongodb.org/about/introduction/
    http://www.mongodb.com/what-is-mongodb

    ReplyDelete

Please do not enter any spam link in the comment box.

NUnit : Introduction

There are several unit test tools in the market, but one of them is NUnit, the most popular tool for doing unit testing. So in this tutorial...