Chapter 4. Interacting with Data – an Introduction
We have seen how to define our data structure, but now we want to interact with it. We want to be able to create database entries, read them, update them, and delete them. To handle these interactions, Mongoose uses methods added to models. This chapter introduces the concept and will look at how to organize our code to best work with this approach.
By the end of this chapter, you will have had a glimpse of how Mongoose helps you to easily interact with your data. You will also have prepared the sample project so that we can dive into practical examples in later chapters.
Model methods and instance methods
As we have seen in Chapter 3, Schemas and Models, a document in a Mongoose collection is a ...
Get Mongoose for Application Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.