Mongoose for Application Development

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

Starting
Simon Holmes

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.
$23.99
$39.99
RRP $23.99
RRP $39.99
eBook
Print + eBook
$29.99 p/month

Subscribe Now

Download this title FREE and instantly access over 3,500 courses today!

With unlimited access to a constantly growing library of over 3,500 courses, a subscription to Mapt gives you everything you need to get that next promotion or to land that dream job. Cancel anytime.

+ Collection
Free Sample

Book Details

ISBN 139781782168195
Paperback142 pages

Book Description

Mongoose is all about putting the data model where it should be: in your application. You can control everything from within your application in JavaScript, eliminating the need to work with the database or a separate management system.

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.

You will see how Mongoose removes a layer of complexity when dealing with MongoDB whilst giving you more control over your data from your application. You will learn how to define schemas and models for your data in JavaScript. Using these schemas and models, you will learn how to build the cornerstone of any web application that will include CRUD operations (creating, reading, updating, and deleting data). If you want to learn how to build applications quickly and efficiently using Node.js, then Mongoose and this book are ideal for you.

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.

Table of Contents

Chapter 1: Introducing Mongoose to the Technology Stack
The technology stack – Node.js, npm, MongoDB, and Express
What Mongoose is all about
Installing the full stack
Summary
Chapter 2: Establishing a Database Connection
Mongoose default connection
About the connection string
Connection options
Closing the connection
Connection events
Connecting our project
Summary
Chapter 3: Schemas and Models
Introducing schemas
Data types allowed in schemas
Where to write the schemas
Writing a schema
Building models
Setting the collection name
Our complete code
Summary
Chapter 4: Interacting with Data – an Introduction
Model methods and instance methods
Setting up the project
Summary
Chapter 5: Interacting with Data – Creation
Creating an instance
Saving an instance
Creating and saving database entry in one step
CRUD – create data
Summary
Chapter 6: Interacting with Data – Reading, Querying, and Finding
Approaches to find and read data
CRUD – reading user and project data
Summary
Chapter 7: Interacting with Data – Updating
Model helper methods
The three-step find-edit-save approach
CRUD – editing users and projects
Summary
Chapter 8: Interacting with Data – Deleting
Deleting data
CRUD – deleting user and projects
Summary
Chapter 9: Validating Data
Mongoose validation – the basics
Understanding validation errors
Doing it your way – create custom validation
Adding validation to our project
Summary
Chapter 10: Complex Schemas
Population – references to other collections
Subdocuments
Data management when modifying existing schemas
Summary
Chapter 11: Plugins – Re-using Code
Reusable schema plugins
Sharing with the community
Summary

What You Will Learn

  • Learn the different methods of using Mongoose to connect to a database
  • Learn to define schemas and building data models
  • Interact with data using schema methods
  • Create databases, collections, and data
  • Query the database to find specific data
  • Edit, save, and delete data
  • Validate data using Mongoose validators
  • Use population to link datasets
  • Use sub-documents and nested schemas to provide data depth
  • Get to grips with code efficiency through re-usable plugins

Authors

Table of Contents

Chapter 1: Introducing Mongoose to the Technology Stack
The technology stack – Node.js, npm, MongoDB, and Express
What Mongoose is all about
Installing the full stack
Summary
Chapter 2: Establishing a Database Connection
Mongoose default connection
About the connection string
Connection options
Closing the connection
Connection events
Connecting our project
Summary
Chapter 3: Schemas and Models
Introducing schemas
Data types allowed in schemas
Where to write the schemas
Writing a schema
Building models
Setting the collection name
Our complete code
Summary
Chapter 4: Interacting with Data – an Introduction
Model methods and instance methods
Setting up the project
Summary
Chapter 5: Interacting with Data – Creation
Creating an instance
Saving an instance
Creating and saving database entry in one step
CRUD – create data
Summary
Chapter 6: Interacting with Data – Reading, Querying, and Finding
Approaches to find and read data
CRUD – reading user and project data
Summary
Chapter 7: Interacting with Data – Updating
Model helper methods
The three-step find-edit-save approach
CRUD – editing users and projects
Summary
Chapter 8: Interacting with Data – Deleting
Deleting data
CRUD – deleting user and projects
Summary
Chapter 9: Validating Data
Mongoose validation – the basics
Understanding validation errors
Doing it your way – create custom validation
Adding validation to our project
Summary
Chapter 10: Complex Schemas
Population – references to other collections
Subdocuments
Data management when modifying existing schemas
Summary
Chapter 11: Plugins – Re-using Code
Reusable schema plugins
Sharing with the community
Summary

Book Details

ISBN 139781782168195
Paperback142 pages
Read More

Read More Reviews

Recommended for You