Donald Feury
  • 📝 Topics
  • 💲 Donate
  • 🌎 Links
  • ✉️ Contact
  • ▶️ Videos
Subscribe
MongoDB

How to set up MongoDB on macOS using brew

The community edition of MongoDB can be set up on macOS using brew by following four simple steps.

  • Donald Feury
Donald Feury Mar 20, 2022 • 1 min read
MongoDB

How to perform a JOIN in MongoDB

If you have relational data in your MongoDB instance, you can perform an operation similar to a JOIN typically done in SQL queries.

  • Donald Feury
Donald Feury Jan 30, 2022 • 2 min read
MongoDB

When to use MongoDB aggregations instead of queries

When it comes to reading data out of your MongoDB instance you have two options, a query using the standard query language or an aggregation pipeline. While you can often use either for many use cases, there are differences in how they are used and what use cases they are a good fit for.

  • Donald Feury
Donald Feury Jan 23, 2022 • 2 min read
How to do conditional execution in Bash
Bash

How to do conditional execution in Bash

In Bash scripts, any command following a && will only execute if the previous conditional or command succeeded (returned 0)

  • Donald Feury
Donald Feury Oct 23, 2021 • 1 min read
How to check if a string is empty in Bash
Bash

How to check if a string is empty in Bash

To check if a string is empty in a Bash script, use the -z conditional which returns 0 (true) if the length of the string is 0 and 1 (false) if it is greater than 0. myVar="hello" if [[ -z "$myVar" ]]; then echo "myVar is empty" else echo "myVar is

  • Donald Feury
Donald Feury Oct 22, 2021 • 1 min read
Use the filter positional operator in MongoDB to update specific array elements
MongoDB

Use the filter positional operator in MongoDB to update specific array elements

For a full overview of MongoDB and all my posts on it, check out my overview. MongoDB provides a filter positional operator $[<name_of_filter>] to only update some elements in an array. If you want to update all the elements in the array, use the all positional

  • Donald Feury
Donald Feury Oct 20, 2021 • 1 min read
MongoDB

Use the all positional operator in MongoDB to update all elements in an array

For a full overview of MongoDB and all my posts on it, check out my overview. MongoDB provides a special update operator $[] to apply an update operation to all elements in an array belonging to matching documents. With the following data inserted into a collection called games: db.games.insertMany(

  • Donald Feury
Donald Feury Oct 19, 2021 • 1 min read
This is how to do upserting in MongoDB
MongoDB

This is how to do upserting in MongoDB

Upserting is a database concept that combines inserting and updating that MongoDB supports

  • Donald Feury
Donald Feury Aug 22, 2021 • 1 min read
How to replicate the output of the FullScreen template from StreamLadder
FFmpeg

How to replicate the output of the FullScreen template from StreamLadder

StreamLadder is a nifty little tool for creating vertical versions of your Twitch clips for platforms like Tiktok and YouTube Shorts. However, I like tinkering with FFmpeg so I replicated the output with a simple command. If we look at the Fullscreen template, all it's essentially doing is cropping the

  • Donald Feury
Donald Feury Aug 17, 2021 • 1 min read
How to do bulk updates in MongoDB
MongoDB

How to do bulk updates in MongoDB

Bulk updating in MongoDB can be done using the update and updateMany methods.

  • Donald Feury
Donald Feury Aug 16, 2021 • 1 min read
How to drop a collection from MongoDB
MongoDB

How to drop a collection from MongoDB

If you want to completely drop a collection, which will result in the loss of all documents in that collection, there is one simple command to do that called drop.

  • Donald Feury
Donald Feury Aug 15, 2021 • 1 min read
How to replace an existing document in MongoDB
MongoDB

How to replace an existing document in MongoDB

MongoDB provides several ways to update specifically one document that works great when doing partial updates. If you want to completely replace an existing document with a new one, you can use replaceOne.

  • Donald Feury
Donald Feury Aug 14, 2021 • 1 min read
MongoDB

How to update a single document in a MongoDB collection

You can update existing documents in MongoDB and if you want to update only one document at a time you have three main options. You can use the update method to update one document. By default, it will only update one document, even if the query provided matches multiple documents.

  • Donald Feury
Donald Feury Aug 13, 2021 • 1 min read
MongoDB

How to create a collection in MongoDB

For a full overview of MongoDB and all my posts on it, check out my overview. If you want to explicitly create a new collection in MongoDB rather than letting it be automatically created when an insert operation happens, you can do so using the createCollection method. If you wanted

  • Donald Feury
Donald Feury Aug 12, 2021 • 1 min read
MongoDB

How to find all the distinct values of a field across your documents in MongoDB using the distinct aggregation method

If you want to find out all the different values for a field across all the documents in a collection, you can use the ready-made distinct aggregation method to find that out.

  • Donald Feury
Donald Feury Aug 11, 2021 • 1 min read
MongoDB

How to bulk insert documents into a MongoDB collection

For a full overview of MongoDB and all my posts on it, check out my overview. Not only can you insert a single document into a collection with the insert method, it can also take in an array of documents for bulk insert operations. The example below will insert all

  • Donald Feury
Donald Feury Aug 10, 2021 • 1 min read
MongoDB

How to insert a single document into a MongoDB collection

For a full overview of MongoDB and all my posts on it, check out my overview. MongoDB has several ways of inserting documents into collections. The main way is using a method on collections called insert. Here is an example: // Let's say we want to insert a new document representing

  • Donald Feury
Donald Feury Aug 9, 2021 • 1 min read
MongoDB

How to count the number of documents in a MongoDB collection or query

For a full overview of MongoDB and all my posts on it, check out my overview. MongoDB has a few ready-made aggregations available as methods and one of those is count. It can be used to determine how many documents are in a collection or returned from a query. Given

  • Donald Feury
Donald Feury Aug 8, 2021 • 1 min read
MongoDB

How to sort the results of a MongoDB query

For a full overview of MongoDB and all my posts on it, check out my overview. After using the find method to get retrieve some documents from MongoDB and further trimming down that result using filters, there may still be a lot of data. It may be easier to work

  • Donald Feury
Donald Feury Aug 7, 2021 • 2 min read
MongoDB

Use the limit method to retrieve a specific number of documents from MongoDB

For a full overview of MongoDB and all my posts on it, check out my overview. While you can use the find method to read data back out of MongoDB and the findOne method is a MongoDB query to pull specifically one result, you can use the limit method after

  • Donald Feury
Donald Feury Aug 6, 2021 • 1 min read
MongoDB

How to retrieve specific documents from MongoDB using filters

For a full overview of MongoDB and all my posts on it, check out my overview. While you can use the find method to read multiple documents out of MongoDB, it is more likely you only want a subset of that data. The find method can take two arguments and

  • Donald Feury
Donald Feury Aug 5, 2021 • 1 min read
MongoDB

How to retrieve only one document from a MongoDB collection

For a full overview of MongoDB and all my posts on it, check out my overview. MongoDB has a convenient method called findOne which is very similar to the find method, except it, returns the actual document instead of a cursor and it will only return the first document. If

  • Donald Feury
Donald Feury Aug 4, 2021 • 1 min read
MongoDB

Get all the documents out of a collection in MongoDB

For a full overview of MongoDB and all my posts on it, check out my overview. The most simple way to read all the documents out of a collection in MongoDB is to use the find method on a collection. Let's say you have a collection in your database called

  • Donald Feury
Donald Feury Aug 3, 2021 • 1 min read
MongoDB

Setting up MongoDB on Windows

For a full overview of MongoDB and all my posts on it, check out my overview. MongoDB can be quickly and easily set up on Windows using the default MSI installation wizard provided by the MongoDB team. To get the installer, follow these steps: Go to the MongoDB Download CenterChoose

  • Donald Feury
Donald Feury Aug 2, 2021 • 1 min read
Introduction to MongoDB
MongoDB

Introduction to MongoDB

MongoDB or you might hear people call it Mongo, is one of the most popular NoSQL database solutions to date. It is open-source, free to use for personal and commercial use, and extremely flexible. Programming languages such as Go ( I have a short example video of interacting with MongoDB using

  • Donald Feury
Donald Feury Aug 1, 2021 • 1 min read
Donald Feury © 2022
  • 💲 Drop me a donation
  • 🗠 Check my stats
  • ❓ FAQ
  • ✉️ Contact Me
Powered by Ghost