Section 7: Lab: Creating and Working with Indexes
- What an index is, and how to create, list and drop indexes in a collection
- Index types: single field, compound, multikey, text and TTL
- Key properties such as unique and partial indexes
- Lab: read explain() output and compare speed before and after adding an index
Section 8: Database Access Control
- Enable authentication, and the idea of role-based access control
- Create user accounts, assign built-in roles and check privileges
- Manage accounts and roles on least-privilege lines
- Lab: keep the connection string in a .env file instead of in the code
Section 9: Lab: MongoDB Atlas in the Cloud
- A short introduction to clusters and replica sets
- Create a free cluster, set up a database user and the IP access list
- Load the sample database and connect with mongosh and Compass
- An overview of Atlas Search and Vector Search for further study
Section 10: Lab: Connecting to and Managing MongoDB with PHP
- Install the MongoDB extension and the mongodb/mongodb library with Composer
- Write the database connection code and handle errors
- Work with databases, collections and documents using CRUD
- Lab: a web page that lists and searches products from MongoDB
Section 11: Lab: Connecting to and Managing MongoDB with Python
- Install PyMongo in a virtual environment
- Work with databases, collections and documents through MongoClient
- Run CRUD and aggregation from Python
- Lab: use AsyncMongoClient for async code in place of the deprecated Motor
Section 12: Workshop: A REST API with Node.js and MongoDB
- Create a new Node.js project and install Express and Mongoose
- Define schemas and models with validation in Mongoose
- Connect to MongoDB Atlas and write a REST API with full CRUD
- Test the API with a REST client and plan the next steps