The document provides an overview of MongoDB, a popular NoSQL database that uses a document-oriented structure for data storage, allowing for flexibility and scalability. Key features include document orientation, indexing for efficient searching, and the ability to aggregate data. It also covers installation processes for both local and cloud versions, specifically MongoDB Atlas, emphasizing the advantages of cloud computing for data management.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
36 views10 pages
Unit 4 - Mongodb
The document provides an overview of MongoDB, a popular NoSQL database that uses a document-oriented structure for data storage, allowing for flexibility and scalability. Key features include document orientation, indexing for efficient searching, and the ability to aggregate data. It also covers installation processes for both local and cloud versions, specifically MongoDB Atlas, emphasizing the advantages of cloud computing for data management.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10
POTTI SRIRAMULU CHALAVADI MALLIKARJUNA RAO COLLEGE OF
ENGINEERING & TECHNOLOGY
MEAN STACK UNIT - 4
MONGODB BY MD. BUSHRA ASSISTANT PROFESSOR DEPARATMENT OF CSE - DATA SCIENCE Introduction Module Overview MongoDB the most popular NoSQL database, is an open-source document-oriented database. The term ‘NoSQL’ means ‘non-relational‘. It means that MongoDB isn’t based on the table-like relational database structure but provides an altogether different mechanism for the storage and retrieval of data. This format of storage is called BSON ( similar to JSON format). A simple MongoDB document Structure: { title: 'MONGoDb', by: 'Md. Bushra ', url: 'https://google.com', type: 'NoSQL' } Introduction Module Overview MongoDB database features Document Oriented: MongoDB stores the main subject in the minimal number of documents and not by breaking it up into multiple relational structures like RDBMS. For example, it stores all the information of a computer in a single document called Computer and not in distinct relational structures like CPU, RAM, Hard disk etc. Indexing: Without indexing, a database would have to scan every document of a collection to select those that match the query which would be inefficient. So, for efficient searching Indexing is a must and MongoDB uses it to process huge volumes of data in very less time. Scalability: MongoDB scales horizontally using sharding (partitioning data across various servers). Data is partitioned into data chunks using the shard key and these data chunks are evenly distributed across shards that reside across many physical servers. Also, new machines can be added to a running database. Aggregation: Aggregation operations process data records and return the computed results. It is similar to the GROUPBY clause in SQL. A few aggregation expressions are sum, avg, min, max, etc Document Database Overview A document database (also known as a document-oriented database or a document store) is a database that stores information in documents. Document databases are considered to be non-relational (or NoSQL) databases. Instead of storing data in fixed rows and columns, document databases use flexible documents. Document databases are the most popular alternative to tabular, relational databases.. Document databases offer a variety of advantages, including: An intuitive data model that is fast and easy for developers to work with A flexible schema that allows for the data model to evolve as application needs change The ability to horizontally scale out.What are the key features of document databases? Document databases have the following key features: Document model: Data is stored in documents (unlike other databases that store data in structures like tables or graphs). Documents map to objects in most popular programming languages, which allows developers to rapidly develop their applications. Flexible schema: Document databases have flexible schemas, meaning that not all documents in a collection need to have the same fields. Note that some document databases support schema validation, so the schema can be optionally locked down. Distributed and resilient: Document databases are distributed, which allows for horizontal scaling (typically cheaper than vertical scaling) and data distribution. Document databases provide resiliency through replication. Querying through an API or query language: Document databases have an API or query language that allows developers to execute the CRUD operations on the database. Developers have the ability to query for documents based on unique identifiers or field values. Understanding JSON Many people think of JSON (JavaScript Object Notation) as a language, but it’s really just a data interchange format that works natively with most modern languages, like Python, Java, PHP, and JavaScript. JSON is commonly used for transmitting data in web applications. As the name implies, JSON is very similar to JavaScript objects in the way it’s written and stored. However, JSON has only properties and no methods. Let’s explain the JSON syntax: JSON objects are written within {curly} braces. Each item is a key-value pair. The keys and string type values are written within double quotes. Other data types— like integer and boolean—don’t need to be written in quotes. Arrays inside JSON strings are written within [square] brackets. Objects and arrays can be embedded within an object. MongoDB Structure and Architecture MongoDB is designed to meet the demands of modern apps with a technology foundation that enables you through: The document data model – presenting you the best way to work with data. A distributed systems design – allowing you to intelligently put data where you want it. A unified experience that gives you the freedom to run anywhere – allowing you to future-proof your work and eliminate vendor lock-in. With these capabilities, you can build an Intelligent Operational Data Platform, underpinned by MongoDB. Application – The software or service that interacts with the database. It sends queries and Query Router – A component retrieves data. responsible for routing queries from the application to the Drivers appropriate database shard. It Drivers are client libraries that helps distribute the workload offer interfaces and methods for efficiently across multiple shards. applications to communicate with MongoDB databases. Drivers will Primary – The main node in each handle the translation of shard responsible for handling documents between BSON write operations. It ensures data objects and mapping application consistency and synchronizes structures. with secondary nodes. .NET, Java, JavaScript, Node.js, Secondary – Replica nodes that Python, etc are some of the store copies of the primary widely used drives supported by node's data. These nodes handle MongoDB. read operations to balance the load and provide redundancy for Shard – A partition of the database fault tolerance. that contains a subset of the data. Sharding is used to improve performance and scalability by distributing data across multiple servers. MongoDB Remote Management Performance Management offering, and threshold event data. You can install and configure the MongoDB on a remote system from the server. In large-scale environments, an external MongoDB can be used to reduce load at the server. To check whether MongoDB that was installed with the Performance Management server is available, enter /usr/bin/apm status mongodb. The output of Service mongodb started (PID 7574) indicates that MongoDB is installed with the Performance Management server. The installation directory for MongoDB is install_dir/mongodb (default is /opt/ibm/mongodb). MongoDB requires one TCP port that must be available, and is verified during the prerequisite check: 27000. About this task Use this procedure to complete the following tasks: Install the MongoDB on a separate system from the Performance Management server. Configure communications between the MongoDB and the server. Disable the MongoDB that was locally installed with the server. For the supported version of MongoDB, see the system requirements report for your offering on APM Developer Center > System requirements. The supported version is available from the Prerequisites tab of the report. Install and activate MongoDB on a remote system: On the remote system, change to the directory where you downloaded the MongoDB directory and run one of the following commands: To install MongoDB in the default /opt/ibm/mongodb directory: install-mongodb.sh Installing MongoDB on the local computer (Mac or Windows) In this article on MongoDB Installation on Windows, we will walk through the step-by-step installation and setup process of MongoDB. This guide is compatible with Windows Server 2022, 2019, and Windows 11, ensuring you’re up and running quickly. From setting up environment variables to running the MongoDB server, we have covered everything. first, download the MongoDB server and then install the MongoDB shell. The Steps below explain the installation process in detail and provide the required resources for the smooth download and install MongoDB. Download MongoDB Community Server Go to the MongoDB Download Center to download the MongoDB Community Server. Version: 7.0.4 OS: Windows x64 Package: msi Key steps: Go to the MongoDB website: Navigate to the official MongoDB download page in your web browser. Select the Community Edition: Choose the "Community Server" option as this is the free version for personal use. Choose your operating system: Select either "Windows" or "macOS" depending on your computer. Download the installer: Download the appropriate installer file, usually an .msi for Windows and a .dmg for Mac. Run the installer: Double-click the downloaded file to launch the installation wizard. Follow the prompts: Accept the license agreement, choose the desired installation options (like a complete installation), and specify the installation directory if needed. INTRODUCTION TO MONGODB CLOUD At its core, MongoDB Atlas is a fully managed cloud database built on the document model, the fastest way to innovate since documents are much easier and more natural to work with. You can store data of any structure and modify your schema anytime as you add new features to your applications. Cloud computing has revolutionized the way businesses work. Businesses are able to share their work, collaborate across the globe, save big time on infrastructure costs, easily scale their applications, and securely store huge volumes of data If you had a file saved on your local machine and wanted to access it from your phone or tablet, that wouldn't be possible. But if you store the same document on OneDrive or Google Docs, you can use WiFi or mobile data to access it from anywhere. Likewise, you can run the MongoDB database on the cloud using MongoDB Atlas, which means you don’t have to instal MongoDB on your machine, but can still use all of its features that your project needs. Simply explained, cloud computing is a set of distributed resources across servers that can be accessed as a service over the internet. Having high-end applications, infrastructure, platforms, software, and many other resources on cloud means that you can get the benefits of these at a low cost, even if your physical machine has limited capabilities.