A simple mongo db model maker
MangoModel is not an ORM. It is a very simple wrapper over the Monk MongoDb library. MangoModel's main purpose is to allow dynamic db switching and data validation.
// Create db connectionvar db = ;// Create modelvar Ant = MangoModel;// Accessing your modelvar Ant = MangoModel;// Set the global db object so you don't have to specify the db every time you define a modelMangoModel;var Rat = MangoModel;
When providing the database connection to either a model or the global MangoModel, you can provide a function that returns the database connection. This allows you to switch the database out as required.
var Cat = MangoModel;var cats = Cat;