i am trying to make a rest api with mongoose and i want to hide the __v property and i succesfully hidden it on find and findById by doing this:
Contact.find({}, '-__v', function(error, list) { });
Contact.findById(req.params.id, '-__v', function(error, item) { });
but when i use the create method
Contact.create(req.body, function(error, item) { });
it returns me the item added with __v property in it.
I ALSO tried this method using select: false on the schema like this
__v: {
type: Number,
select: false
}
This method also does the same thing, it hides the __v property from find and findById but also doesn't hide it from the crate method returned object.