Welcome to the MongoDB Tutorials. The objective of these tutorials is to get an in-depth understanding of MongoDB Database. In these tutorials, we will cover various MongoDB functions with examples. The tutorial starts with an overview of MongoDB, Installation of MongoDB and later we will cover various functions such as find, query, update and delete. Apart from these we will also cover the Performance and Tuning aspects of MongoDB.
In addition to these tutorials, we will also cover common issues, Interview questions and How To's of MongoDB.
What is MongoDB?
MongoDB is a powerful, flexible, and scalable data store. It combines the ability to scale out with many of the most useful features of relational databases, such as secondary indexes, range queries, and sorting. MongoDB is also incredibly featureful: it has tons of useful features such as built-in support for MapReduce-style aggregation and geospatial indexes.
There is no point in creating a great technology if it’s impossible to work with, so a lot of effort has been put into making MongoDB easy to get started with and a pleasure to use. MongoDB has a developer-friendly data model, administrator-friendly configuration options, and natural-feeling language APIs presented by drivers and the database shell. MongoDB tries to get out of your way, letting you program instead of worrying about storing data.
- Where Clause in MongoDB
- How to sort document in MongoDB
- Find and Modify in MongoDB
- How to Find/Search Document in MongoDB
- MongoDB Unset
- Using Select in MongoDB
- MongoDB Interface
- Collections in MongoDB
- Delete/Remove collection in MongoDB
- MongoDB Index
- How to insert document in MongoDB
- MongoDB Database
- MongoDB Data Types
- How to install MongoDB
- How to delete document in MongoDB
- How to Update document in MongoDB
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.
The database is a physical container for collections. Each database gets its own set of files on the file system. A single MongoDB server typically has multiple databases.
A collection is a group of MongoDB documents. It is the equivalent of an RDBMS table. A collection exists within a single database. Collections do not enforce a schema. Documents within a collection can have different fields. Typically, all documents in a collection are of similar or related purposes.
A 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 structures, and common fields in a collection's documents may hold different types of data.
Below given table shows the relationship of RDBMS terminology with MongoDB
Below given example shows the document structure of a blog site which is simply a comma-separated key-value pair.
title: 'MongoDB Overview',
description: 'MongoDB is no sql database',
by: 'tutorials point',
tags: ['mongodb', 'database', 'NoSQL'],
message: 'My first comment',
dateCreated: new Date(2011,1,20,2,15),
message: 'My second comments',
dateCreated: new Date(2011,1,25,7,45),
Interested in mastering MongoDB Training?
Enroll now for FREE demo on MongoDB Training Online.
_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 provides a unique id for every document. These 12 bytes first 4 bytes for the current timestamp, the next 3 bytes for machine id, the next 2 bytes for process id of the MongoDB server, and the remaining 3 bytes are simple incremental value.
Any relational database has a typical schema design that shows the number of tables and the relationship between these tables. While in MongoDB there is no concept of relationship
Advantages of MongoDB over RDBMS
-Schemaless: MongoDB is a document database in which one collection holds different documents. The number of fields, content, and size of the document can differ from one document to another.
-Structure of a single object is clear
-No complex joins
-Deep query-ability. MongoDB supports dynamic queries on documents using a document-based query language that's nearly as powerful as SQL
-Ease of scale-out: MongoDB is easy to scale
-Conversion/mapping of application objects to database objects not needed
-Uses internal memory for storing the (windowed) working set, enabling faster access of data
Why should use MongoDB
Document Oriented Storage: Data is stored in the form of JSON style documents
Index on any attribute
Replication & High Availability
Fast In-Place Updates
Professional Support By MongoDB
Where should use MongoDB?
Content Management and Delivery
Mobile and Social Infrastructure
User Data Management