Markwell Blog

Programming, Music, Photography, whatever!

Sunday, March 19, 2023

The Nuances of Mongoose Select

Developing strategies for more effective use of select/project statements with mongoose.

Selecting and Projecting: SQL vs NoSQL

One of the biggest differences I've noticed when working with document storage compared to relational database is the default behaviour of selecting fields in a query.

In SQL, while the * operator is always available to select all available fields, it's an active choice to use it. The user must explicitly choose to select whichever fields are required, with the option to return all of them.

Contrast this with MongoDB, where the default behaviour is to select the entire document with any query. To narrow down the results the user must opt in to selecting their desired fields, rather than be forced to make the choice up front (even if that choice is to use *).

While this is a fundamental difference between these two systems, I have never really seen it, or the implications of it, discussed in any detail. I believe that in many situations the decision to have Mongo implicitly return all fields without the user making a selection is harmful and causes more problems than the convenience that it affords.

Keep reading...
Saturday, January 28, 2023

Introducing Markwell

What is Markwell and why should I use it?

A New Blog

I've been meaning to start a blog forever, but each time I tried I came away unsatisfied with the tools to do it. Things like Jekyll and Hugo were both sort of in the right direction, but they each had issues which stopped me from really enjoying the experience of using them.

I don't have any experience with Ruby and I wanted to use tools that I know rather than learning something completely new for this project. Hugo was close, but I found the templating system to be messy and the documentation to be difficult to find a foothold with. Just getting a simple project setup felt like a chore.

The closest I got was generating a static site with Next.js and serving it with github pages, but it felt clunky and I much prefer using Svelte/Sveltekit over React.

I've been reading all kinds of interesting posts about creatively shoehorning SQLite into different situations recently and felt inspired to see if it tie in well for storing blog posts in memory.

Keep reading...