Backend (Day 009) DB
Backend (Day 009) DB
Store data: Keep information safe and organized. Think of it like storing
documents in folders within the filing cabinet.
Retrieve data: Quickly find and access the information you need when you
need it. Like easily pulling out a specific folder and document.
Example: Think about your phone contacts app. It uses a database to store all
your contact names, numbers, and other details. When you search for a
contact, the database helps the app quickly retrieve that information.
Notes 1
Think of it like linking folders together in your filing cabinet if they are
related.
SQL (Structured Query Language): They use a special language called SQL to
manage and query data.
You use SQL to ask questions like "Show me all customers who live in New
York."
This means you need to define the structure of your tables (columns and
data types) before you start storing data.
Like deciding how many columns your spreadsheet will have and what
kind of information will go in each column before you start filling it.
Examples:
MySQL
PostgreSQL
Oracle Database
Good for:
Situations where data consistency and accuracy are critical (like financial
transactions).
Key-Value pairs: Like dictionaries where you have a key to find a value.
Notes 2
Wide-column stores: Designed for massive amounts of data.
NoSQL (Not Only SQL): Often called NoSQL databases because they don't
primarily use SQL.
You don't need to define the structure of your data strictly beforehand.
Like being able to put different kinds of documents and folders into your
filing cabinet without having to pre-define everything.
This means you can easily add more servers to handle more data and
traffic.
Examples:
Good for:
Notes 3
Data Structure Tables with rows and columns Documents, key-value, graphs, etc.
BSON is like a more efficient version of JSON that computers can process
faster.
This gives you a lot of flexibility. You don't have to pre-define the structure
of your data rigidly.
Use Cases:
Notes 4
Mobile and Web Applications
Real-time Analytics
E-commerce platforms
It's the actual program that runs and manages your MongoDB database.
Self-Managed: You need to install and manage the Community Edition server
yourself on your own computer or server.
You are responsible for setting it up, configuring it, and maintaining it.
It's great for learning, development, and even production for many
applications.
Contrast with MongoDB Atlas: There's also MongoDB Atlas, which is a cloud-
based, fully managed database service offered by MongoDB. With Atlas,
MongoDB takes care of server management for you.
MongoDB Compass
What is it? A Graphical User Interface (GUI) tool for MongoDB.
Notes 5
Analyze performance: Get insights into how your database is performing.
User-Friendly: It's much easier to use Compass for many tasks than using the
command-line interface (like the mongo shell).
Analogy: Compass is like a visual dashboard for your MongoDB filing cabinet.
It lets you see what's inside, search for things, and manage everything without
having to use complicated commands.
Free to use: MongoDB Compass is free to download and use with any
MongoDB server, including the Community Edition.
Notes 6