MongoDB: making queries
This is a completed online course called MongoDB: making queries with an estimated workload of 10 hours, carrying out 60 of 60 activities, from 02/27/2024 to 03/01/2024. Topics include the following:
- Preparing the database;
- Find Method;
- Aggregation stages;
- Aggregation operators;
- Other methods.
Preparing the database: after the Showbank2 database creation at NoSQLBooster platform, the command prompt was used in order to make the collections import through the mongoimport command. There are three collections: Accounts (Contas), Clients (Cientes) and Address (Endereco).
In order to follow the standard name in plural, the Address (Endereco) collection was renamed as Addresses (Enderecos) collection.
Find Method: works with many different operators, such as: comparison ($eq, $gt, $gte, $in, $lt, $lte, $ne, $nin), logical ($and, $not, $nor, $or) and array ($all, $elemMatch, $size). Below there are some query operators examples.
Aggregation stages: way of processing a large number of documents in a collection by passing them through different stages that make a pipeline. As the examples below, the stages can filter, sort, group, reshape and modify documents that pass through the pipeline.
Aggregation operators: used in stages to modify documents and perform calculations. They can work with many different expressions, such as: arithmetic, conditional, date and string.
Other methods: in addition to the Find method, there are other methods that can be used to manipulate data stored in MongoDB, such as:
- updateOne: updates a single document within the collection based on the filter;
- updateMany: updates all documents that match the specified filter for a collection;
- findAndModify: updates and returns a single document;
- findOneAndUpdate: updates a single document based on the filter;
- findOneAndReplace: replaces a single document based on the filter;
- findOneAndDelete: deletes a single document based on the filter and sort criteria, returning the deleted document.
In conclusion, the methods, aggregation stages and aggregation operators mentioned above are just part of a large list of options that MongoDB works with.
Get Dalvolinda Silva’s stories in your inbox
Join Medium for free to get updates from this writer.
[Here is the Certificate of Completion.]









