Java, Javascript/Ajax/JQuery

MONGOOSE Tips and Tricks for Uncommon Cases

Mongoose is an object modelling package for Node that essentially works like an ORM for many popular languages much like Hibernate is for JAVA. Below are some of the mongoose special scenario(s) I stepped upon while working on the project. It took me some time to figure it out. Hopefully below details would prove helpful to you thereby...


MongoDB, Technology

The Most Awaited Feature “SQL Joins” is Now Available in MongoDB 3.2

SQL Joins are used to combine documents/rows from 2 or more tables based upon common field present in them. MongoDB 3.2 launched the most awaited feature "Joins" which is supported in SQL database however was not present in the earlier version of MongoDB. This feature will change the way you design your database schema and application...


Database, MongoDB

Too Many Indexes May kill your DB performance

Everyone thinks of creating index, but nobody pays attention towards removing them once they are created and not required .Too many indexes or unnecessary index can degrade your DB performance. To Optimize indexes in mongo we need to understand following things : How indexes works in mongoDB: Let’s say we have created compound...



Mongo Case Insensitive InList Query

As we know in Mongo the match queries are case sensitive. So whether we do a find() operation or use $match stage of aggregate pipeline, the condition would be true only if its a exact case sensitive match. Of cource we can use regex to do case insensitive queries but then again it will not work when we are trying to find a match with in...


AWS, Database

Troubleshooting MongoDB Replication Cluster

MongoDB is an efficient, reliable and fast processing database for the applications which generate the data in a schema-free manner. For high-availability of data in MongoDB, we use MongoDB replicas. We generally face some issues in managing and syncing the cluster, which doesn’t let us achieve the full flavour of Mongo...



Mongo Point in Time Restoration

While working with databases sometimes there is a need to have data till a specific time or date across all the secondaries or database peers which is useful for testing a particular functionality. Also, in the event of outage, few folks would like to restore it to a specific weekend or month end just to have uniformity across all the...


Database, MongoDB

Diving deep with MongoDB Indexing

Whether you are a lazy programmer dreaming to achieve more by doing less or a super serious databases professional aspiring to make a mark in the land of DATA, Indexing is THE thing you can't afford to live without. Why? Because of follows: Performance Unbelievably better performance Performance better than James Bond!!!!! Yes...


DevOps, Docker

MongoDB Replica set using Docker Networking and Docker Compose

Recently, I got a chance to dockerize a traditional MongoDB replica set. Currently, I am doing it for QA and UAT environment where MongoDB replica set is setup on a single host. So, in this blog, we will do it on a single host using Docker Networking and Docker Compose. Scenario: Set up a MongoDB replica using version 3.0.5 set...


Database, MongoDB

Mongo Delayed Node

  This was my live experience with Mongo when I felt need of something like Delayed Replica. I had a Mongo ReplicaSet setup for some client with 3 nodes - 1 Primary and 2 Secondaries. It is known that whatever is written to Primary’s Oplog, is replicated to the secondaries immediately without any lag or lag of some milliseconds...


Database, MongoDB

A use case and implementation of MongoDB Aggregation queries.

In any DBMS, aggregations are operations that process data records and return computed results. MongoDB provides a rich set of aggregation operations that examine and perform calculations on the data sets. Running data aggregation on the mongod instance simplifies application code and limits resource requirements. In my current...


MongoDB, Node.js

Executing MongoDB shell commands from Javascript file

MongoDB uses javascript interface for the shell commands. We can really use this feature in a great way - by writing the MongoDB (shell) commands in a javascript (.js file) and execute in single go. In this blog, I am going to show an example for the same: [javascript] print('===== My Demo Script ====='); ...

by Salil