Skip to content

evilive3000/mongoose-hide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mongoose-hide

Plugin hides fields when user calls document.toJSON(). By default it automatically hides fields _id, __v, createdAt, updatedAt and adds virtual property id

Build Status

Usage

Requires nodejs >= 6.0

const mongohide = require('mongoose-hide');

const schema = new mongoose.Schema({
  visibleField: String,
  hiddenField: {
    type: String,
    hidden: true
  }
});

schema.plugin(mongohide);

to disable hiding some of autohidden fields call plugin with options:

schema.plugin(mongohide, {createdAt: false});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published