he/him. aspiring non-buster and mediocre programmer. umaine CS/MAT '25.
Now I can finally write new tests to fail for the features I just added.
Now I can finally write new tests to fail for the features I just added.
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).
Mongoose provides functions for your standard database CRUD operations, like find() and save(), which do what you probably expect them to.
Mongoose provides functions for your standard database CRUD operations, like find() and save(), which do what you probably expect them to.
My favorite joke was the passing mention of a strain of pot called “This is Permanent”
My favorite joke was the passing mention of a strain of pot called “This is Permanent”