Restaurant is a Mongoose model. I tried to change things in place and it doesn't work:
Restaurant.find({}, function(err, results) {
for (var i = 0; i < results.length; i++) {
delete results[i].__v;
}
I think results[i]
is a model object. I tried to see check the property descriptors with the following and it's says undefined
:
console.log(JSON.stringify(Object.getOwnPropertyDescriptor(results[i], '__v')));
Why doesn't delete on the object work? And how come I can't see the property descriptor?
EDIT: So it's a Mongoose document. But what in Javascript parlance can an object such as a Mongoose document be based on something else other than a Javascript object? Some wrapper base on internal C code or something?