Databases / MongoDB
Data Modeling
Schema patterns, validation, and Mongoose on top of the driver.
Schema design in MongoDB
Flexible schemas speed up early product work but query patterns still need deliberate shape. This chapter compares embedding and referencing, common modeling patterns, anti-patterns, the 16 MB document limit, and optional JSON Schema validation at the collection level.
Mongoose with MongoDB
Mongoose adds schemas, validation, middleware, and populate on top of the official driver. This focused chapter explains when an ODM helps, how to type schemas in TypeScript, and how lean queries differ from hydrated documents—without replacing the driver-first approach used elsewhere.