https://github.com/crsten/mongoose-setup
Mongoose plugin to make setup cleaner/easier
https://github.com/crsten/mongoose-setup
Last synced: 6 months ago
JSON representation
Mongoose plugin to make setup cleaner/easier
- Host: GitHub
- URL: https://github.com/crsten/mongoose-setup
- Owner: crsten
- License: mit
- Created: 2020-07-12T13:58:25.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T14:14:34.000Z (over 3 years ago)
- Last Synced: 2025-03-16T04:34:10.172Z (over 1 year ago)
- Language: JavaScript
- Size: 1.37 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](http://commitizen.github.io/cz-cli/)
[](https://travis-ci.org/crsten/mongoose-setup)
[](https://www.npmjs.com/package/mongoose-setup)
[](https://www.npmjs.com/package/mongoose-setup)

# mongoose-setup
This plugin allows you to setup your mongoose structure in a cleaner way. (Better docs will be added later...)
```js
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)
```