@bouncingpixel/mongoose-helpers

0.0.3 • Public • Published

mongoose-helpers

Collection of Mongoose schema plugins.

Working With

Requirements

  • NodeJS 6 LTS

Installing

Install the package using your JS package manager of choice, such as npm or yarn.

For example, with npm or yarn:

$ npm install --save @bouncingpixel/mongoose-helpers

$ yarn add @bouncingpixel/mongoose-helpers

Using mongoose-helpers/auto-bcrypt

Just add the plugin to the schema and set the fields which are automatically bcrypt'd

MySchema.plugin(require('@bouncingpixel/mongoose-helpers/auto-bcrypt'), {
  fields: ['password']
});

Using mongoose-helpers/replace-image

Add the plugin to the schema, set the fields that are managed images, and set the remover function.

MySchema.plugin(require('@bouncingpixel/mongoose-helpers/replace-image'), {
  fields: ['previewImage'],
  remover: RackspaceService.removeFile
});

Readme

Keywords

none

Package Sidebar

Install

npm i @bouncingpixel/mongoose-helpers

Weekly Downloads

5

Version

0.0.3

License

MIT

Unpacked Size

4.77 kB

Total Files

5

Last publish

Collaborators

  • hallmatt