Using MongoDB Shell
Get started with the MongoDB Shell (Mongoose), a command-line tool for creating databases, managing collections, and running queries or admin commands—perfect for hands-on interaction with your data.
We'll cover the following...
We'll cover the following...
What is the MongoDB Shell?
The MongoDB Shell (often called mongo or mongosh) is a command-line tool that allows us to interact directly with our MongoDB server. We can use it to:
Create and manage databases and collections.
Insert, query, update, and delete documents.
Run administrative commands.
Starting the MongoDB Shell
Initially, we need to have MongoDB installed on our local machines. For this course, we are not required to set up; everything is preinstalled.
Note: For local setups, refer to the appendix.
Once installed, we can start the shell by opening the terminal or command prompt and typing: