I am trying to delete an object's property but the property does not get deleted at all...
What I have:
var tagFound = yield tags.findById(this.params.tagId);
debug('prior delete: %j', tagFound);
delete tagFound.password;
debug('after delete: %j', tagFound);
What I get:
api_v1 prior delete: {"_id":"55e064e9727b44c32a262c0f","expires":"2015-08-29T13:40:57.673Z","password":"$2a$08$hucJyHIU5gholAB1L.wVKeFoTmvFho9xFiJAAvmwmtKphLuJ9Hq4K","type":"free","name":"teste","__v":0,"visible":true,"locations":[{"latitude":65.9667,"longitude":-18.5333,"_id":"55e064e9727b44c32a262c10","timestamp":"2015-08-28T13:40:57.572Z"}]}
api_v1 after delete: {"_id":"55e064e9727b44c32a262c0f","expires":"2015-08-29T13:40:57.673Z","password":"$2a$08$hucJyHIU5gholAB1L.wVKeFoTmvFho9xFiJAAvmwmtKphLuJ9Hq4K","type":"free","name":"teste","__v":0,"visible":true,"locations":[{"latitude":65.9667,"longitude":-18.5333,"_id":"55e064e9727b44c32a262c10","timestamp":"2015-08-28T13:40:57.572Z"}]}
Maybe my eyes are too tired, but I simply cannot figure this out, does anybody see something obvious that I am missing here?
Update: I put this into http://jsfiddle.net/fc8mohwp/, the problem is, it is working there, but not here (iojs). Should there be any difference?
deletereturn?tagFoundcome from? If the password field comes from a HTML-Tag than it cannot be deleted. Only user defined properties can be deleted. At least that's the case in a browser but probably something similar is happening in node.node.jstag and insertio.js