Learn to speed up your application development by using Mongoose to harness the power of Node.js and MongoDB.
Mongoose streamlines application development on the Node.js stack and this book is the ideal guide to both the concepts and practical application. From connecting to a database to re-usable plugins, it’s all here.
Mongoose for Application Development is a practical, hands-on guide that takes you from installing the technology stack through the steps of developing a web application. It covers the key features of Mongoose and how to use them to rapidly develop a Node.js and MongoDB application.
This book introduces the full technology stack of Node.js, MongoDB, Express, and Mongoose. It will take you through the process of building an application on this stack with a focus on how Mongoose makes the process quicker and easier.
Using practical examples throughout, Mongoose for Application Development not only teaches you about the concepts of Mongoose, but walks through how to use them to build a real-life application.
What this book covers
Chapter 1, Introducing Mongoose to the Technology Stack, takes a look at the Node. js, MongoDB, and Express technology stack and introduces Mongoose and shows where it fits in.
Chapter 2, Establishing a Database Connection, covers the different methods of creating database connections with Mongoose, including how and when to use them.
Chapter 3, Schemas and Models, introduces the two cornerstones of Mongoose, covering how to create them and how they relate to the data.
Chapter 4, Interacting with Data – An Introduction, explains how Mongoose provides methods for easily interacting with data, setting the scene for the following four chapters.
Chapter 5, Interacting with Data – Creation, covers the ways we can use Mongoose to create data and save it to the database. Chapter 6, Interacting with Data – Reading, Querying, and Finding, covers the ways we can use Mongoose to find the data we want by querying the database and reading the data back into Model instances. It shows how to use the built-in methods, and also how to extend Mongoose to run the specific queries that you may want.
Chapter 7, Interacting with Data – Updating, covers the ways we can use Mongoose to change existing data, including the built-in helper methods, and a more robust approach for data integrity.
Chapter 8, Interacting with Data – Deleting, covers the ways we can use Mongoose to delete documents from the database.
Chapter 9, Validating Data, looks at maintaining data integrity, covering the validators built in to Mongoose and explaining how to add custom validation.
Chapter 10, Complex Schemas, introduces the concepts of population and subdocuments to allow richer data models, mimicking some of the functionality found with traditional SQL JOIN statements.
Chapter 11, Plugins – Reusing Code, introduces the Mongoose plugin architecture, covering how to create your own re-usable plugins to remove repetition in your schemas.
Author: Simon Holmes