# MongoDB

{% embed url="https://www.youtube.com/@MongoDB" %}

* an open-source NoSQL database written in C++ language.
* uses JSON like documents with optional schemas.
* inbuilt support for data partitioning (Sharding)

Features

* Indexing
* Aggregation
* Special Collection and index types
* File Storage
* Sharding

### Scaling

* The documented oriented data model of MongoDB makes it easier to split data across multiple servers.
* Balancing and loading data across a cluster is done by MongoDB. It then redistributes automatically.

![](https://1151231797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQAaqgCwmb83T8T0x2j%2Fuploads%2FWPd6Zw3mo7ae1mkITnGd%2Fimage.png?alt=media\&token=bdaa25ed-7fa7-47e3-a55c-f6740f84620d)

* The mongos acts as a query router, providing an interface between client applications and sharded cluster.
* Config servers store metadata and configuration settings for the cluster. Each sharded cluster must have its own config servers.
* MongoDB uses the config servers to manage distributed locks.

Geospatial Indexes

Types

* 2dsphere
* 2d
