manager.model

Sets up a model, retrieves a collection, and sets up any required indexes

Arguments

name (string): name of the mongo collection

[definition] (object): definition

Returns

A model instance, the model instance will also be avaliable at:

db.user
db.models.user

Example

const user = db.model('user', definition)