Skip to main content

Posts

Showing posts with the label Mongo

Getting started with Mongoose, a beginner's perspective

Mongoose is an ODM that takes away the complexity of all the code you'd have to think and write and that you realise that could be abstracted and reused between all pieces of Entities your application will require. Two main features will help you from the beginning Handles the connection to the MongoDB instance using the official driver behind the scenes Allows to describe your Entities, or Documents how I should name them better, using Schema implementation that offers you the Model , as expected in the MVC pattern. The Schema is what you need to look into first, than Models . The Models will allow you to do all CRUD operations, supports pre built in Validation that can be extended with any custom rules, comes with built in Getters and Setters and allows any custom ones. Clever feature to keep in mind Also, Mongoose allows you to hook plugins . This is what DRY really means. Any small problem that can be solved and it's solution reused in Models is a prime...