0% found this document useful (0 votes)
19 views

Mongodb

Explanation

Uploaded by

reshminfathima2
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Mongodb

Explanation

Uploaded by

reshminfathima2
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

MongoDB is a document database. It stores data in a type of JSON format called BSON.

If you are unfamiliar with JSON, check out our JSON tutorial.

A record in MongoDB is a document, which is a data structure composed of key value pairs similar to the
structure of JSON objects.

A MongoDB Document

Records in a MongoDB database are called documents, and the field values may include numbers,
strings, booleans, arrays, or even nested documents.

Eg:
{
title: "Post Title 1",
body: "Body of post.",
category: "News",
likes: 1,
tags: ["news", "events"],
date: Date()
}

****************************************************************************************************************
SQL vs Document Databases

SQL databases are considered relational databases. They store related data in separate tables.

When data is needed, it is queried from multiple tables to join the data back together.

MongoDB is a document database which is often referred to as a non-relational database.

This does not mean that relational data cannot be stored in document databases.

It means that relational data is stored differently. A better way to refer to it is as a non-tabular database.

MongoDB stores data in flexible documents.

Instead of having multiple tables you can simply keep all of your related data together. This makes
reading your data very fast.

You can still have multiple groups of data too. In MongoDB, instead of tables these are called collections.

*****************************************************************************************************************

Local vs Cloud Database

MongoDB can be installed locally, which will allow you to host your own MongoDB server on your
hardware.

This requires you to manage your server, upgrades, and any other maintenance.
You can download and use the MongoDB open source Community Server on your hardware for free.

However, for this course we are going to use MongoDB Atlas, a cloud database platform.

This is much easier than hosting your own local database.

To be able to experiment with the code examples, you will need access to a MongoDB database.

Sign up for a free MongoDB Atlas account to get started.


****************************************************************************************************************

MongoDB Query API Uses

You can use the MongoDB Query API to perform:

Adhoc queries with mongosh, Compass, VS Code, or a MongoDB driver for the programming language
you use.

Data transformations using aggregation pipelines.

Document join support to combine data from different collections.

Graph and geospatial queries.

Full-text search.

Indexing to improve MongoDB query performance.

Time series analysis.

You might also like