Mongoose __v property - hide?
To disable '__v' property, which is not recommended, use the versionKey
schema option:
var Schema = new Schema({...}, { versionKey: false });
To hide it from all queries, which sometimes can be not what you want too, use the select
schema type option:
var Schema = new Schema({ __v: { type: Number, select: false}})
You can disable the "__v" attribute in your Schema definitions by setting the versionKey
option to false
. For example:
var widgetSchema = new Schema({ ... attributes ... }, { versionKey: false });
I don't think you can globally disable them, but can only do it per Schema. You can read more about Schema's options here. You might also find the Schema set method helpful.