Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adarshasnah/mongoose-sanitize-json
https://github.com/adarshasnah/mongoose-sanitize-json
Last synced: 20 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/adarshasnah/mongoose-sanitize-json
- Owner: adarshasnah
- License: mit
- Created: 2015-09-16T13:36:30.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-28T06:16:46.000Z (about 9 years ago)
- Last Synced: 2024-09-14T12:21:24.539Z (2 months ago)
- Language: JavaScript
- Size: 160 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mongoose-sanitize-json
[![npm version](https://badge.fury.io/js/mongoose-sanitize-json.svg)](http://badge.fury.io/js/mongoose-sanitize-json)
This plugin removes the following fields "_id, __v, __t" and published virtuals "id" when the document is converted to json.
(Note other virtual fields will also be published)## Installation
```sh
$ npm install mongoose-sanitize-json
```### Usage
```javascript
var mongoose = require('mongoose');
var sanitizeJSON = require('mongoose-sanitize-json');var personSchema = mongoose.Schema({
name: String,
age: Number
});personSchema.plugin(sanitizeJSON);
```