Zephyrusk
zephyrusk.bsky.social
Zephyrusk
@zephyrusk.bsky.social
Pfp: avogado6

he/him. aspiring non-buster and mediocre programmer. umaine CS/MAT '25.
A week from today (1/23) I will be in Connecticut and the next day (1/24) I will be in NYC. Any recommendations for cool stuff to do around Hartford/New Haven/NYC?
January 16, 2026 at 6:39 PM
Back to 12/12 we are so back.

Now I can finally write new tests to fail for the features I just added.
3/12 tests passing
Been in such a rut coding today that I have decided I am writing everything today and not testing it until tomorrow. Almost finished for the night, so I'm feeling a bit better. Surely this will have no unforeseen consequences.
January 15, 2026 at 9:44 PM
3/12 tests passing
Been in such a rut coding today that I have decided I am writing everything today and not testing it until tomorrow. Almost finished for the night, so I'm feeling a bit better. Surely this will have no unforeseen consequences.
January 15, 2026 at 7:36 PM
Been in such a rut coding today that I have decided I am writing everything today and not testing it until tomorrow. Almost finished for the night, so I'm feeling a bit better. Surely this will have no unforeseen consequences.
January 14, 2026 at 2:30 AM
This is super useful for implementing a generic cascading soft delete in my application, where I am managing soft deletion and reference management in separate plugins.

This would also allow me to extend an existing plugin without breaking the base version. Cool!
January 13, 2026 at 4:11 AM
This turned out to not be the case! On a whim, I tried passing "deleteOne" to the middleware function post() with a callback, and it worked!

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.
January 13, 2026 at 4:11 AM
I wanted to trigger some middleware when softDelete() was called. The Mongoose documentation lists the strings that can be passed to pre/post -- like the built-ins save and find.

Cursory research seemed to suggest that this list was not extendable and I'd have to handle this without middleware.
January 13, 2026 at 4:11 AM
I'm writing middleware inside Mongoose plugins. Plugins can also add static and instance methods to Schemas.

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.
January 13, 2026 at 4:11 AM
Each query type also comes extendable middleware, so you can define code that runs before (pre) or after (post) every query of a specific type.

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).
January 13, 2026 at 4:11 AM
I'm learning to use Mongoose ODM for working with my MongoDB right now and found something very cool about middleware and feel compelled to share.

Mongoose provides functions for your standard database CRUD operations, like find() and save(), which do what you probably expect them to.
January 13, 2026 at 4:11 AM
Watched Ted (my older brothers’ favorite movie) tonight.

My favorite joke was the passing mention of a strain of pot called “This is Permanent”
January 11, 2026 at 4:59 AM
Going to start posting on here, probably.
January 9, 2026 at 5:10 PM