The MongoDB Shell
Learn how to use the MongoDB Shell to interact with local and remote MongoDB databases. In addition to learning the basics of MongoDB Shell, you'll learn how to customize it based on your needs.
The MongoDB Shell
Unit Overview
In this unit, you'll learn about the MongoDB Shell (mongosh), the command line interface that enables you to interact with local and remote MongoDB deployments. You'll learn how to install mongosh and connect to both Atlas and self-managed deployments. Next, you'll learn how to configure and use mongosh along with its companion library (.mongoshrc.js). Finally, you'll learn some tips and tricks for working with mongosh.
Prerequisites
Lessons in This Unit
- Lesson 1 – Installing and Connecting to the MongoDB Shell
- Lesson 2 – Configuring the MongoDB Shell
- Lesson 3 – Using the MongoDB Shell
- Lesson 4 – Using the MongoDB Shell Library (.mongoshrc.js)
- Lesson 5 – MongoDB Shell Tips and Tricks
-
01.
-
02.Lesson 2: Configuring the MongoDB Shell
- Learn
- Practice
-
03.Lesson 3: Using the MongoDB Shell
- Learn
- Practice
-
04.Lesson 4: Using the MongoDB Shell Library (.mongoshrc.js)
- Learn
- Practice
-
05.Lesson 5: MongoDB Shell Tips and Tricks
- Learn
- Practice
-
06.Conclusion
- Learn
John McCambridge | University Curriculum Engineer
John is a Curriculum Engineer on the University team at MongoDB. Before his work as a Curriculum Engineer, he was an instructor and teaching assistant for coding boot camps at UT (Austin), and UCLA. Additionally, he worked as a QA engineer for a startup called Coder and spent five years at Apple Inc. John is a passionate software engineer and educator who enjoys taking complex topics and making them digestible for the community.
Vick Mena | Director, Curriculum
My name is Vick and I've been in the wild for over 25 years. I grew up at IBM working on the BIOS for the IBM eServer line in Austin, TX before moving to Wall St. I've worked on all phases of software development from low-level to middleware to UI but feel most comfortable in the middle. I also drank the devops kool-aid having moved a product line to AWS while at Dow Jones & Co with the help of an amazing team. I then pivoted into the secure space and worked on software/hardware reverse engineering. I always thought I'd eventually teach and this role lets me leverage all of my experience to lead this motley crew of passionate educators.
Hello, and welcome! In this unit, you'll learn about the MongoDB Shell, also called `mongosh`. `mongosh` is a command line interface that can be used for interacting with local or remote MongoDB databases.
In this unit, we’ll cover some basic commands that you can use to manage and interact with your MongoDB databases. We’ll also cover some advanced features such as running JavaScript code, importing scripts, and customizing the way the shell looks.
My name is John. I’m a Curriculum Engineer for MongoDB University, and I’ll be your guide through this unit.
The MongoDB Shell, or mongosh, is a tool for interacting with MongoDB. Learning how to use it will make you faster and more agile, and will help you unlock new ways to interact with your data.
In this unit, we’ll cover the following topics: Installing mongosh, connecting to a MongoDB Atlas cluster and local deployment, configuring mongosh, using mongosh, using the `.mongoshrc.js` file, and finally, tips and tricks for working with mongosh.
To learn about these topics, we’ll take you through a series of videos, code summaries, quiz questions, and interactive labs.
For the labs in this unit, you will need a MongoDB Atlas cluster, which will be created for you as part of this unit. Though it’s not required, you may benefit from installing mongosh locally, which will help you manage your Atlas cluster easily from your machine. You’ll learn how to do that in this unit.
Before you begin, you should have a basic understanding of the document model and document databases. You should also be familiar with running commands from a command line interface.
By the end of this unit, you will be able to connect, manage, and interact with your MongoDB database by using the MongoDB Shell. You will also be able to customize the information `mongosh` displays and add additional functionality by using external scripts. Let's get started!