cofx logo

blog by cofx

Experimenting with MongoDB index creation and Spring Boot

Creating indexes for MongoDB collections with Spring Boot is easy. You annotate your entities with the correct annotations, you set to true in your configuration file, and you're done. Indexes will be created when you start your application.

Over time, however, people will start using your application, and your MongoDB collections will grow as a result. Creating an index for an empty collections takes very little time. Creating an index for a big collection can take a while. Because of this, configuring Spring to handle index creation on startup can lead to unpleasant surprises. The startup of your application will block until the new index is created, and this can take a while for existing, large collections.

Additionally, your application will not start at all if something goes wrong while creating an index. This could happen if you try to modify an existing index, for example.

All in all, it's worthwhile to take a closer look at various ways to programmatically create, find, and delete indexes.

Continue reading

Tiny Utterances: a minimalistic comment system

Are you looking for a free, serverless™ comment system for a technical blog? Maybe Tiny Utterances is the tool you need. All you need to get started is a GitHub issue and a few lines of CSS and JavaScript.

Continue reading

Dependency injection and loggers in Clojure

Logging functions have to be impure to be useful. If they don't change the state of the world around them by writing something somewhere, why would you use them? This makes any function that uses a logging function directly impure too. If that is something you want to avoid, you could inject a logging service and use that instead of the logging function. Let's do that and see what challenges we come across.

Continue reading