Tutorial Series

How To Manage Data with MongoDB

How To Manage Data with MongoDB

Introduction

MongoDB is a document-oriented NoSQL database management system (DBMS). Unlike traditional relational DBMSs, which store data in tables consisting of rows and columns, MongoDB stores data in JSON-like structures referred to as documents.

This series provides an overview of MongoDB’s features and how you can use them to manage and interact with your data.

Summary View
detailed View

Series Tutorials

Conceptual-article

This conceptual article outlines the key concepts related to document databases and discusses benefits of using them. Examples used in this article reference MongoDB, a widely-used document-oriented database, but most of the concepts highlighted here are applicable for most other document databases as well.

Tutorial

How To Use MongoDB Access Control

Published on July 22, 2021

MongoDB employs a robust mechanism to control access and privileges to a databases system known as Role-Based Access Control (RBAC). In this tutorial, you’ll learn how RBAC works, the meaning and purpose of the principle of least privilege, as well as how to use MongoDB’s access privileges features in practice.

Tutorial

How To Use the MongoDB Shell

Published on July 29, 2021

The MongoDB shell is an interactive console you can use to connect to the database server and execute commands on it, allowing you to perform administrative tasks and read, write, or manipulate data directly. This tutorial explains learn how to use the MongoDB shell to connect to a MongoDB database and query the database interactively.

Tutorial

Data management involves four fundamental types of database operations: operations that allow you to create, read, update, and delete data. Collectively, these operations are known as CRUD operations. This tutorial outlines how to create new MongoDB documents and later retrieve them to read their data. It also explains how to update the data within documents, as well as how to delete documents when they are no longer needed.

Tutorial

How To Create Queries in MongoDB

Published on September 15, 2021

MongoDB provides a robust query mechanism that makes it straightforward to define filtering criteria when retrieving documents. In this tutorial, you’ll learn how to query MongoDB collections using a different range of filters and conditions. You will also learn what cursors are and how to use them within the MongoDB shell.

Tutorial

How To Use Indexes in MongoDB

Published on September 28, 2021

Indexes are one of the most essential tools the database administrator can use to consciously aid the database engine and improve its performance. In this tutorial, you’ll learn what indexes are, how to create them and check if they are used when querying the database.

Tutorial

How To Use Aggregations in MongoDB

Published on October 22, 2021

MongoDB provides aggregation operations through aggregation pipelines — a sequential series of data processing operations through which the documents go to obtain the final result. In this tutorial, you’ll learn by example how to use the most common features of the aggregation pipelines.

Tutorial

How To Use MongoDB Compass

Published on October 26, 2021

With MongoDB Compass, you can access most of the features the MongoDB database engine offers through an intuitive visual display. You can glance through the databases, collections, and individual documents, interactively create queries, manipulate existing documents, and design aggregation pipelines through a dedicated interface.

In this tutorial, you’ll install MongoDB Compass and familiarize yourself with different tasks that can especially benefit from using the graphical tool.

Tutorial

How To Use Transactions in MongoDB

Published on November 23, 2021

Though they were a staple feature of relational database management systems for many years, ACID transactions are a relatively new feature in MongoDB. This tutorial explains what transactions are and how you can initiate and commit them in a MongoDB database. It also provides an overview of the ACID principles required for any transaction: atomoicity, consistency, isolation, and durability.

Tutorial

How To Design a Document Schema in MongoDB

Published on November 30, 2021

Document-oriented databases like MongoDB make it possible to break free from rigidity and limitations of the relational model. However, the flexibility and freedom from being able to store self-descriptive documents in the database can lead to other pitfalls and difficulties. This conceptual article outlines the common guidelines related to schema design in a document-oriented database and typical ways to model relationships between data.

Tutorial

The practice of synchronizing data across multiple separate databases is called replication. In MongoDB, a group of servers that maintain the same data set through replication are referred to as a replica set. This tutorial provides a brief overview of how replication works in MongoDB before outlining how to configure and initiate a replica set with three members.

Tutorial

This tutorial outlines how to update an existing replica set to use keyfile authentication. The procedure involved in this guide will also ensure that the replica set doesn’t go through any downtime, so the data within the replica set will remain available for any clients or applications that need access to it.

Tutorial

How To Use Sharding in MongoDB

Published on December 21, 2021

Sharding is a strategy some users will implement to help them scale their database horizontally, with the hope being that the improved scalability will outweigh the added complexity. This guide outlines how sharding works in MongoDB, a popular, document-oriented, NoSQL database.

Tutorial

How To Perform Full-text Search in MongoDB

Published on January 6, 2022

There are multiple highly specialized tools that have full-text search capabilities, but many database management systems today have such features, though perhaps with some limitations. In this tutorial, you’ll learn by example how to create a text index in MongoDB and use it to search the documents in the database against common full-text search queries and filters.

Tutorial

How To Use Schema Validation in MongoDB

Published on January 24, 2022

In MongoDB, the database engine feature that makes it possible to apply constraints on the document structure is called Schema Validation and is built around JSON Schema, an open standard for JSON document structure description & validation. In this tutorial, you’ll learn about schema validation and format requirements in MongoDB, and how to apply these to control structure of documents in a database.

Tutorial

How To Monitor MongoDB's Performance

Published on January 28, 2022

MongoDB comes installed with a variety of tools and utilities you can use to observe database performance. In this tutorial, you’ll learn how to monitor database metrics on-demand using built-in commands and tools. You’ll also become familiar with MongoDB’s database profiler which can help you detect poorly optimized queries.

Check out all our Tutorial Series

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.