I got to know through search that Mongodb uses indexing to save the data so how it is different than SQL in that basics. I have the idea that MongoDB stores the data in JSON whereas SQL stores it in form relation. Could anyone explain to me about it in little dept and the concept behind it?
So a little overview of MongoDB from top down:
- The mongod, running instance usually referred to as a node:
mongodis the primary daemon process for the MongoDB system. It handles data requests, manages data access, and performs background management operations.
Clients/Driver connect to the mongod. Or via the mongo shell
When connected you can create databases
Inside a database are collections
Documents are stored in collections
MongoDB stores documents in collections. Collections are analogous to tables in relational databases.
MongoDB stores data records as BSON documents. BSON is a binary representation of JSON documents
MongoDB documents are composed of field-and-value pairs
MongoDB is basically schema free; therefore the documents in the same collection can have any number of different fields. This also allow a user to add or remove fields from a document without having any restructuring.
This document model allow users to embed documents directly inside of other documents, which allow you to represent hierarchical relationships like arrays, and other complex structures without the need of joins.
Indexes are used in Mongo to improve query performance.
Without indexes, MongoDB must perform a collection scan , i.e. scan every document in a collection, to select those documents that match the query statement
Hope that helps.
Thanks for help