MongooseJS allows a lot of customization for the models and schemas that you define, far beyond attributes and documents. You can add methods to model instances, for example. You can also add “static” (type level) methods to the Schema and model type. Beyond that, you can even add virtual attributes that allow you to get and set data without having to create yet another field on the model. All of this creates a very powerful combination of tools that can be used to develop very robust object models using MongooseJS and MongoDB.
In this episode of WatchMeCode, I'll show you how to work with virtual fields, model instance methods and static methods to reduce the amount of code you are writing, and to clean up your application code.