What is Mongo DB?
Mongo DB is C++ open-source document database. This article will help you learn mongo DB database with simple and easy steps. Before going further one should have basic understanding of database, text editor etc. and also basic concept of RDBMS.
Collection of different types of data is called Database. We can also it is a type of container. Every single mongo DB server has more than one databases.
Mongo DB Is a document oriented database which provides great performance, very data availability and easy scalability.
Why to use Mongo DB?
· Document Oriented Storage
· Attribute with index
· Any time data availability
· Rich Queries
· Fast In-Place Updates
How to use Mongo DB?
Supported Platform.
Starting in version 2.2, Mongo DB does not support Windows XP. Please use a more recent version of Windows to use more recent releases of Mongo DB.
For windows user.
Download mongodb.msi from below given link
https://www.mongodb.com/download-center?jmp=docs&_ga=1.34194593.1801687251.1468239835
After downloading locate the file and run a wizard will guide you through the installation process.
Basic syntax to use Database
use DATABASE_NAME
Example
This example will create database with name f_db:
>use f_db
switched to db f_db
Example to insert document to db
>db.f_col.insert({
_id: ObjectId(7df78ad8902c),
title: 'MongoDB Overview',
tags: ['mongodb', 'database', 'NoSQL'],
})
Other interesting things to know?
Collection
RDBMS
|
MongoDB
|
Database
|
Database
|
Collection
|
Table
|
Documents
|
Tuple/Row
|
Field
|
Column
|
Embedded document
|
Table Join
|
Primary Key (Default
key _id provided by mongo db itself)
|
Primary Key
|
Mongo DB
|
My SQL/Oracle
|
Mongo
|
My SQL/SQL plus
|
Group of mongo DB documents is called a collection. It is same as RDBMS table. It limit within one single database. Document in the collection are related to each other or it is of similar type. There is nothing like schema in collections.
Document
A document is a set of key-value pairs. Documents have 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.
A set of key value pair is called a Document. It contains dynamics schema which means the documents with same collection does not need to have the same set of fields or structure it can hold data with different types.
Advantages of Mongo DB over RDBMS
· Schema less
· Structure of a single object is clear
· No complex joins
· Deep query-ability. We can write dynamic query.
· Tuning
· Mongo DB is easy to scale
· Uses internal memory for storing the (windowed) working set, enabling faster access of data
No comments:
Post a Comment