Enabling Logs Query in Mongodb using Go
One way to debug an application is through logs. They can be used to identify issues, understand the execution flow, and also monitor the application’s behavior. Among their types, database query logs are very useful for understanding what is happening with queries and other write operations. In this post, I will show how to enable MongoDB query logs in the official Go driver.
By default, logs in the official MongoDB driver for Go are disabled.
List of apps I use every day - Version 2023
I enjoy reading posts about the tools/apps people use in their daily lives, whether for work or personal use. I always end up discovering new tools or functionalities that I wasn’t aware of. That’s why I decided to create a post about the apps I use every day. The idea is to update this post every year to see how things change.
iTerm2: It has been my terminal of choice for macOS for years and continues to serve me well to this day.
Highlights in a Technical Interview for Junior Candidates
Highlights in a Technical Interview for Junior Candidates Recently, someone who is seeking their first opportunity in the development field asked me for advice on what to study or what certifications to obtain to stand out in a job interview. I didn’t respond immediately and took some time to think, as the landscape has changed significantly since I was a Junior Developer.
So, I came up with a list of 7 topics that I believe make a difference for someone at this professional stage and would catch my attention during an interview process.
Performing Benchmark Tests in Go
Benchmark testing in programming is the act of efficiently comparing performance between algorithms in order to choose which approach to follow in certain scenarios. We can also apply when deciding which external libraries or frameworks to use, in addition to evaluating if any refactoring will bring harm to our code.
The Go language already has tools for these types of tests by default, making the experience more user-friendly and without the need for external tools.
Installing Portainer
Portainer is an Open Source application for managing Docker on local machines or servers. Through its graphical interface it is possible to view and edit your Containers, Images, Volumes and so on. And its installation is very easy as it is distributed as a Docker image.
Just perform the following steps:
Create a volume to persist your settings: docker volume create portainer_data Run the docker command to create the container and inform some initial configuration parameters: docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.
Yet Another MongoDB Golang Tutorial
After years relying on Community drivers like mgo and globalsign/mgo, last year MongoDB announced they were building it’s own solution. Last March they released the version 1.0.0, so let’s see how to make some normal operations using the Oficial driver.
First of all, you need to download the driver using go get.
go.mongodb.org/mongo-driver/mongo Assuming your MongoDB installation is using the default setting, your method should be like this:
package main import ( "context" "log" "go.