Summary

In this chapter, we've seen how we can take repeated paths from our schemas and turn them into a single Mongoose plugin. We've learned how to create them as separate files, include them in our application, and also use schema middleware to set data on a save operation. We have used all of this knowledge to create plugins and add them to our MongoosePM application, tidying up our code and removing repetition.

This is the final chapter of Mongoose for Application Development. By now you should have the tools and understanding to enable you to build a web application based on everything Mongoose has to offer. I'm sure that by now you will agree that Mongoose is a very useful addition to the Node.js and MongoDB technology stack.

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.