Set up Gradle to test a simple Java project
2021-08-31Install Gradle using one of the many methods:
https://gradle.org/install/
- Open a terminal, run gradle –version. If it runs, you are good to go.
Create project folder
- Create a folder somewhere as the root folder for your Java …
Check stdin, stdout and stderr in Python unit testing
2021-08-19(Updated: 2021-08-23)In blackbox testing, we can use diff command to check an output file against expected results. To check standard output during unit testing, we can use a mock stdout and stderr to capture any outputs.
Using unittest module …
Writing Bash Scripts
2021-08-15To Bash or not to Bash
Writing shell scripts can automate command execution and help us become more productive. Bash is the default shell for most linux distributions.
Which Bash
Check that your have Bash installed.
$ which bash …
How to use "grep" command
2021-08-13Syntax
grep [OPTION...] PATTERNS [FILE...]
grep [OPTION...] -e PATTERNS ... [FILE...]
grep [OPTION...] -f PATTERN_FILE ... [FILE...]
The grep
command takes in text from stdin or a file.
Quick Examples
The lady with the …
Creating Data Relations in MongoDB
2021-06-03Unlike relational databases, there are no native methods for relations in MongoDB. However, we can try to create relations by referencing the _id between documents.
We will continue to use the sample database, sample_supplies, for this demo. In the …
Schema Validation in MongoDB
2021-06-02Schema validation
While MongoDB does not enforce data type validation by default, it can be enabled by specifying validation rules when creating a collection.
// Use database: sample_supplies
> use sample_supplies
switched to db …
MongoDB Bulk Write
2021-06-01bulkWrite() method
db.collection.bulkWrite()
method can perform these operations:
- insertOne
- updateOne
- updateMany
- replaceOne
- deleteOne
- deleteMany
It has the following syntax:
db.collection(
[
{
<operation1>: { …
MongoDB Aggregation Pipeline
2021-05-31Aggregation pipeline stages
Aggregation pipeline is an array of aggregation methods that process data stage-by-stage until a result is returned at the end of the pipeline.
Aggregation pipeline stages for a collection is executed by the …
A Practice Scenario for MongoDB
2021-05-30Managing inventory for an office supply store
Imagine running an office supply company. We need to keep track of customer information, sales data, and store location.
Sales data query
We may ask these questions related to sales …
MongoDB Basic CRUD Operations
2021-05-29How records are stored
- Each record is called a Document, which is BSON formatted.
- Documents are grouped into a Collection.
- Collections are grouped into a Database.
List all DB
> show dbs
admin 0.000GB
config 0.000GB
local …