https://github.com/abhi11210646/mongoose-sanitize
Mongoose plugin that sanitizes input fields to prevent injection attacks, with options to include or skip specific fields.
https://github.com/abhi11210646/mongoose-sanitize
mongoose sanitizer traverse
Last synced: 12 months ago
JSON representation
Mongoose plugin that sanitizes input fields to prevent injection attacks, with options to include or skip specific fields.
- Host: GitHub
- URL: https://github.com/abhi11210646/mongoose-sanitize
- Owner: abhi11210646
- License: mit
- Created: 2019-05-15T11:32:50.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2025-01-17T05:28:32.000Z (over 1 year ago)
- Last Synced: 2025-06-16T09:33:06.778Z (about 1 year ago)
- Topics: mongoose, sanitizer, traverse
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/mongoose-sanitize
- Size: 97.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Usage
```javascript
const sanitizer = require('mongoose-sanitize');
mongooseSchema.plugin(sanitizer, options); // `options` optional field
```
### Options
```
let options = { skip:[], include:[] }
```
- **Skip** Array indicating which fields should be excluded from being sanitized. If omitted or empty, every field in the document will be sanitized.
- **Include** Array indicating which fields should be included to be sanitized. If omitted or empty, every field in the document will be sanitized.