It’s not in the documentation, but I’m trying to figure out how to set asynchronous defaults with Mongoose. I see the model.pre("save", function(next){}) setup, but I have no idea how to mutate fields on the model which is currently being saved. Does Mongoose bind this to the item being saved?
It’s not in the documentation, but I’m trying to figure out how to set
Share
Yes, in middleware,
thisrefers, at runtime, to the model instance.