1.0.21 • Published 7 years ago

mongoose-ref-validator v1.0.21

Weekly downloads
8
License
MIT
Repository
github
Last release
7 years ago

Mongoose Ref Validator

Validate that referenced documents exist in Mongoose.

Installation

npm install mongoose-ref-validator

Usage

Add plugin to Mongoose.

mongoose.plugin(require('mongoose-ref-validator'));

Enable validation by adding a conditions property.

var messageSchema = new Schema({
  channel: {
    conditions: {}, // Enables validation
    type: ObjectId,
    ref: 'Channel'
  },
  user: {
    conditions: { permissions: 'admin' }, // Further restricts validation
    type: ObjectId,
    ref: 'User'
  }
});

License

Mongoose Ref Validator is released under the MIT license.

1.0.21

7 years ago

1.0.20

7 years ago

1.0.19

7 years ago

1.0.18

7 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago