MongoDB in Action

Piyush Bagani - May 14 '21 - - Dev Community

Basics

If we want to develop an application which deals with a large volume of data, then we need to choose one such database which always provides a high – performance data storage solutions. So that, we can achieve the performance in the solution in terms of the data store and data retrieval with accuracy, speed, and reliability.

Now, if we categorized the database solutions then there are mainly two types of database categories available i.e. RDBMS or Relational Database like SQL Server, Oracle, etc. and another type is NoSQL database like MongoDB, CosmosDB, etc.

NoSQL

NoSQL databases can be categorized into four different types as given below:

  1. Key Valued
  2. Graph Oriented
  3. Document-based
  4. Big Table Families

Out of these four types, document database is the most popular and widely used database in today’s world. This type of databases always designed on the basis of a document-oriented approach to store data. This type of databases always acts an important role to aggregate the data from the documents and also represents the data in a very easy and searchable or organized form. MongoDB is the most commonly used database in the development industry as a Document database.
In document databases, the basic concept of table and row in compare with SQL database has been changed. Here row has been replaced by the term document which is much more flexible, Table has been replaced by the term Collection.

What is MongoDB?

MongoDB is one of the most popular open-source NoSQL databases written in C++. As of February 2015, MongoDB is the fourth most popular database management system. It was developed by the company 10gen which is now known as MongoDB Inc.

MongoDB is a document-oriented database that stores data in JSON-like documents with dynamic schema. It means you can store your records without worrying about the data structure such as the number of fields or types of fields to store values. MongoDB documents are similar to JSON objects.
alt text

Why MongoDB is so popular?

MongoDB is a NoSQL database, so we need to understand when and why we need to use this type of database in real-life applications. Since in normal circumstances, MongoDB always preferred by the developers or project managers when our main concern is the deal with a large volume of data with high performance. If we want to insert thousands of records in a second, then MongoDB is the best choice for that.

Features of MongoDB

  • Indexing flexibility: It allows indexing of any field in a document, improving the search speed to a considerable degree.
  • Retrieving data from multiple documents: MongoDB uses the JSON query format and dynamic schema for efficient performance. MongoDB support field, range-based query, regular expression or regex etc for searching the data from the stored data.
  • We can perform load balancing in MongoDB by using Sharding. It scales the database horizontally by using Sharding.
  • The dynamic database schema used in MongoDB is called the BSON.
  • MongoDB supports replication of the database.

Some Practical MongoDB Use Cases

MongoDB will also give some special attention to scaling, sharding, performance, and indexing.

MongoDB is good for the below types of situations:

  1. Content Management Systems
  2. E-Commerce type of product-based applications
  3. Finance and Investment Applications

MongoDB also provides official support for a large number of programming languages and frameworks.

Some Real-World Companies That Use MongoDB:

  1. Google
  2. eBay
  3. Intuit
  4. Cisco
  5. Adobe
  6. Shutterfly
  7. AstraZeneca

And Many More...

CASE STUDY Of CISCO

alt text

Cisco is the worldwide leader in networking, transforming how people connect, communicate and collaborate. In November 2011, Cisco launched WebEx Social (previously known as Quad), an enterprise collaboration platform designed for today's social, mobile, visual and virtual workforce. A “Facebook for enterprises,” WebEx Social connects people to the information and expertise they need, when they need it. Users share knowledge and ideas throughout the enterprise, and across geographic and organizational boundaries. When their existing relational database needed a NoSQL extension to power the collaborative workspace, Cisco turned to MongoDB as their NoSQL database of choice.

The Problem

WebEx Social is a true Enterprise 2.0 platform, “a place where people ‘live’ at work,” according to Biren Gandhi, principal architect for Cisco’s Cloud Collaboration Applications Technology Group (CCATG). The comprehensive collaboration platform combines the four core Enterprise 2.0 pillars – business processes, content, communication, and social features – that enable users to work together effortlessly. With their existing relational database, complex SQL queries against highly normalized schema were time-consuming and Cisco had little room to scale horizontally. Additionally, it was difficult to manage schema upgrades and migrate data from release to release.

WebEx Social’s rapid evolution required expanded data store capabilities and the ability to build successful new social features. Cisco sought an open-source, NoSQL solution that was scalable, flexible, and met the product’s hardcore enterprise needs: secure, mature commercial support, able to deliver consistent backup and disaster recovery, and easy to integrate with legacy systems. After an extensive evaluation and successful proof of concept, Cisco adopted MongoDB in mid-2011.
Why MongoDB?

MongoDB now serves as the primary real-time data store for WebEx Social’s social features that are write-heavy in nature. For example, a social activity feed that notifies thousands of users depending on some complex privacy and visibility rules. Additionally, Cisco uses MongoDB to perform some social network analytics. With MongoDB’s lightweight MapReduce feature, Cisco developers are able to automatically generate, with ease, recommendations such as users to connect with, communities to join and interesting content to view, as well as statistics, including top contributors, most popular colleagues and most downloaded docs.

"MongoDB is a very active, open-source project with a vibrant community. It matches WebEx Social’s feature set and fits in line exactly with our needs,” said Biren Gandhi.

EASY TO IMPLEMENT DOCUMENT MODEL

MongoDB’s document-based data model offers Cisco the right balance between complex relational databases and the pure key-value store of most NoSQL solutions.

Easy mapping from the domain model to JSON docs and complex querying capabilities enable Cisco to cross-reference users and query embedded lists, functions that were either not possible in their existing database or were costly to perform. In contrast with a relational model, which requires a three-step process of fetch-update-commit, MongoDB’s in-place atomic updates allow for “one-stop operations,” according to one of theirs official.

MILLISECOND RESPONSE TIME

With MongoDB, Cisco sped up reads from 30 seconds in some extreme cases to tens of milliseconds per object and eliminated caching needs in certain cases. As the WebEx Social platform evolves, Cisco plans to migrate more write-heavy features to MongoDB.

HIGHLY SCALABLE

MongoDB meets the demands of WebEx Social’s high-volume write activity. MongoDB offers a fast, easy way to de-normalize, index, and extract information from data stores, and its unique compound and geospatial indexing are a big plus.

HIGH AVAILABILITY

Cisco uses built-in sharding and replica sets, which are easy to use and enable high availability through automatic failover of nodes and recovery of member nodes.

Results

The Cisco development team is constantly evaluating the most effective product roadmap to drive customer success on WebEx Social. MongoDB provides Cisco with a user-friendly platform for customers and an easy, powerful technology for developers. Cisco is focused on rolling out new features quickly and offering flexibility to users, and “MongoDB is a big piece of that,” said Biren Gandhi.

Thank You For Reading

Keep Learning, Keep Hustling🎯🎯

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .