mongoose-gridfs
mongoose-gridfs copied to clipboard
Add virtual to schema
Is it possible to modify the attachment schema to add a virtual? I tried adding an "id" virtual (simply returns this._id). It manages to get the correct id but returns undefined when called.
gridFSbucket.schema.virtual("id").get(function(){
console.log("Called virtual get on " + this._id); // correct id
return this._id; // when called i get undefined
});