mongoose-utils

collection of mongoose plugins and schemas

npm install mongoose-utils
4 downloads in the last week
18 downloads in the last month

Mongoose Utils

A collection of mongoose validations, plugins, and utilities.

var utils = require('mongoose-utils'),
    mongoose = require('mongoose');

var User = new mongoose.Schema({
  email         : { type: String, index: true, required:true, unique: true, validate: [utils.validate.email, 'not valid'] },
  password      : { type: String, trim: true, required:true, validate: [utils.validate.length(4), 'required to be at least 4 characters'] }
}, {strict:true});

// Plugins

User.plugin(utils.plugin.timestamps);
User.plugin(utils.plugin.extendedMethods);
npm loves you