Wa0003.
Wa0003.
Introduction:
NoSQL databases are a category of database systems that deviate from the traditional relational
database model. They are designed to handle large volumes of unstructured or semi-structured data
more efficiently than SQL databases. Here's a brief overview of what NoSQL databases are, why
they are useful, and their key differences compared to regular SQL databases:
NoSQL:
NoSQL stands for "Not Only SQL." It represents a wide range of database technologies that
are non-relational and schema-less, meaning they don't require a fixed table schema like SQL
databases. NoSQL databases are often used for handling unstructured, semi-structured, or
rapidly changing data, common in modern web and mobile applications, IoT, and big data
scenarios.
Usefulness of NoSQL:
• Flexible Schema: NoSQL databases allow you to store and manage data without a predefined
schema, making it easier to handle evolving data structures and accommodating changes
without costly migrations.
• Scalability: NoSQL databases are designed to be horizontally scalable, distributing data
across multiple nodes, which enables them to handle massive amounts of data and high traffic
loads.
• High Performance: With their simplified data models and efficient storage formats, NoSQL
databases can provide fast read and write operations, making them suitable for real-time and
big data applications.
• Availability: NoSQL databases often prioritize high availability, ensuring that the system
remains operational even in the face of failures or network partitions.
• Data Model: In SQL databases, data is organized into structured tables with fixed schemas,
and relationships between tables are maintained using foreign keys. NoSQL databases, on
the other hand, use various data models like document-based, key-value, column-family, or
graph to store and manage data.
• Query Language: SQL databases use SQL (Structured Query Language) for querying and
manipulating data. NoSQL databases, depending on their type, may use different query
languages or APIs such as JSON-based queries for document databases, simple key-value
access, or specialized graph traversal languages for graph databases.
• ACID Transactions: SQL databases usually support ACID (Atomicity, Consistency,
Isolation, Durability) transactions, ensuring data integrity. NoSQL databases may provide
weaker consistency models (like eventual consistency) to achieve high availability and
scalability.
• Schema Evolution: NoSQL databases allow for dynamic and schema-less data models,
making it easier to modify data structures without needing to alter the entire database schema.
In contrast, SQL databases require schema changes to add or remove columns or change data
types.
• Scalability: NoSQL databases are typically designed to scale horizontally by adding more
nodes to the cluster, whereas scaling SQL databases often involves vertical scaling by
upgrading hardware or using sharding techniques.
MongoDB:
1. Download MongoDB
• Locate the downloaded MSI file and double-click on it to run the installer.
• The installer wizard will guide you through the installation process.
3. Choose Setup Type
• In the installer, choose the "Complete" setup type to install all the MongoDB
components.
• You can customize the installation path if you prefer, but the default path is usually
fine.
• Check the box "Install MongoDB as a Service" if you want MongoDB to start
automatically with Windows.
5. Finish the Installation
• By default, MongoDB will store data in the "\data\db" directory on the drive where
MongoDB is installed (e.g., C:\Program Files\MongoDB\Server{version}\data\db).
• If you want to use a different data directory, create a new folder and remember its path
for later use.
• If you want to use MongoDB from the Command Prompt or PowerShell, you can add
the MongoDB binaries to the system's PATH environment variable.
• To do this, search for "environment variables" in the Windows search bar, and click on
"Edit the system environment variables."
• In the System Properties window, click the "Environment Variables" button.
• Under "System variables," scroll down to the "Path" variable, and click "Edit."
• Click "New" and add the path to the MongoDB bin directory.
• Click "OK" to save the changes.
• Locate the downloaded MSI file and double-click on it to run the installer.
• The installer wizard will guide you through the installation process.
• Click "Next" and then "Install" to proceed with the installation.
• Once the installation is complete, click "Finish."
3. Download MongoDB Shell
• Locate the downloaded MSI file and double-click on it to run the installer.
• The installer wizard will guide you through the installation process.
• Click "Next" and then "Install" to proceed with the installation.
• Once the installation is complete, click "Finish."
• If you want to use the MongoDB Shell (mongo) from the Command Prompt or
PowerShell, you can add the MongoDB Shell binaries to the system's PATH environment
variable.
• Start MongoDB Compass