he/him. aspiring non-buster and mediocre programmer. umaine CS/MAT '25.
This would also allow me to extend an existing plugin without breaking the base version. Cool!
This would also allow me to extend an existing plugin without breaking the base version. Cool!
Mongoose automagically took up the name of my instance method and enabled middleware on it. From what I can tell, this is not mentioned in the documentation.
Mongoose automagically took up the name of my instance method and enabled middleware on it. From what I can tell, this is not mentioned in the documentation.
Cursory research seemed to suggest that this list was not extendable and I'd have to handle this without middleware.
Cursory research seemed to suggest that this list was not extendable and I'd have to handle this without middleware.
For example, I define `schema.methods.softDelete = function(){}` as an instance method which sets the `deleted` property of a document (a Model instance) to true.
For example, I define `schema.methods.softDelete = function(){}` as an instance method which sets the `deleted` property of a document (a Model instance) to true.
So, by doing `schema.post("find", function(){})`, you can define a function that runs every after each find() query on a particular Schema (e.g. a User).
So, by doing `schema.post("find", function(){})`, you can define a function that runs every after each find() query on a particular Schema (e.g. a User).