Category Archives: MongoDB

Capped Collections in MongoDB

What is Capped Collection? As the name suggests, a collection created with a Cap [ Limit on Size and No. Of documents] are said to be Capped Collection. Use Case: Application Logging, History, Audit Info are the classic examples where Capped Collection will be of immense use. How to create a Capped Collection ? >… Read More »

Covered Queries – MongoDB

Covered Queries help us in querying the data faster. This is achieved by ensuring the index created contains all the fields required by the query. It doesn’t require to examining any documents apart from the indexed ones. We need to ensure that 1. All the fields in the query as well as results returned are… Read More »

MongoDB – Part 5 – Indexing

Different Types of indexing in MongoDB MongoDB provides the following indexes to increase the performance for accessing the data Default _id Index Single Field Index Compound Index Multikey Index Special Index [ Geospatial, Text, TTL] Hashed Indexes Let’s discuss about at each one of the Index: As a first step let’s execute the following script… Read More »

MongoDB – Part 5 – Beginning of Indexes

Indexing is a way to optimize performance of a database by minimizing the number of disk accesses required when a query is processed. Indexing helps to optimize the performance of a database by reducing the iterations of accesses when a query is executed. Said that creating too many unnecessary indexes and not creating the required… Read More »

MongoDB – Part 4: Operators

Lets work on the below data : { “_id” : ObjectId(“5ac5540cad718d31f9c60545”), “VodName” : “House Of Cards”, “Language” : “English”, “Genre” : [ “Politics”, “Thriller” ], “Category” : [ “Multi Part Video” ], “CountryPermission” : [ “India”, “USA”, “UK”, “UAE” ], “Rating” : 5 } { “_id” : ObjectId(“5ac5545cad718d31f9c60546”), “VodName” : “Elementary”, “Language” : “English”, “Genre”… Read More »

MongoDB – Part 3 – CRUD Operations

 Agenda:  How to: Insert One record Bulk Insert Save Difference between Save and Insert Insert One Record: We can insert a record in a existing collection or write an insert without creating required collection. In this case MongoDB automatically creates the collection for you. In the above example you can see we never created Assets… Read More »

MongoDB – Part 2 – Journals

In the last post we learnt using queries through the CLI environment. Here we will see How MongoDB uses Journal feature for its operations. When any write operations happen, an entry is made to the Journal and then a sync happens to the database. This way on account of any system shut down, data could… Read More »

MongoDB – Part 1 – Basics

Official Definition from MongoDB: MongoDB is a document database with the scalability and flexibility that you want with the querying and indexing you need.   We will cover the following topics: Understanding important concepts Ways to communicate with MongoDB Let’s play around with MongoDB in CLI Important Concepts Database path By default the physical location… Read More »