mongoose-setup
v1.0.0
Published
plugin for cleaner mongoose setups
Downloads
204
Readme
mongoose-setup
This plugin allows you to setup your mongoose structure in a cleaner way. (Better docs will be added later...)
const mongoose = require('mongoose')
const schema = new mongoose.Schema(
{
name: {
type: String,
required: true,
set: val => Capitalize(val, true),
},
email: Types.Email({
required: true,
}),
phone: Types.Phone(),
upsell: Boolean,
},
{
timestamps: true,
},
)
// Initialize like this:
require('mongoose-setup')(module, schema)