To understand the MongoDB basics, we need to look at how data is stored in MongoDB.
Data in MongoDB is made up of three types of components: databases, collections, and documents. The database sits at the top of the hierarchy, collections at the next level, and documents at the bottom.
A database provides a container for storing and organizing data.
Each database contains one or more collections, and each collection contains zero or more documents.
A database can contain multiple collections, but a collection cannot span multiple databases. Likewise, a collection can contain multiple documents, but a document cannot span multiple collections.
Studio 3T organizes and presents data elements based on the MongoDB document structure, which makes it a handy tool for understanding that structure.
In the following sections, you’ll apply what you’ve learned from the MongoDB basics and use Studio 3T to create a database and a collection and add documents to the collection, importing the documents from a .json file. You’ll then query the documents, view the results in different views, and then update some of the values.
By the end of this section, you will learn how to:
- Create a collection from a .json file
- Review the collection in different views
- Use Visual Query Builder to query the data
- Update the data directly within the collection
What you will need:
- A text editor such as Notepad (Windows) or TextEdit (macOS)
- Access to a MongoDB Atlas cluster
- Ability to download a .json file from the Internet