Introduction to MongoDB and the Node.js Driver
5 min read
Module Overview
What You’ll Learn
- Explain how MongoDB’s document model differs from a relational database
- Connect a Node.js application to MongoDB with the native driver
- Perform basic CRUD operations against a real MongoDB database
💡 Why this module matters: Modules 1 through 6 covered PostgreSQL, a relational database. MongoDB stores data differently, as documents, not rows and tables, this module introduces that model directly, with the native driver, before Mongoose adds schemas on top of it.
What’s Covered
- The document model, collections and documents versus tables and rows.
- Connecting to MongoDB, the official Node.js driver and a connection string.
- Basic CRUD,
insertOne,find,updateOne,deleteOne, and their variants. - When to reach for MongoDB, and how its trade-offs differ from PostgreSQL’s.
Hands-On
By the end of this module, you’ll have connected a Node.js application to a real MongoDB database with the native driver, and performed CRUD operations against it directly.
Next module: Mongoose, schemas and validation on top of MongoDB.