Skip to content
View Dm2998's full-sized avatar
🔆
I may be slow to respond.
🔆
I may be slow to respond.

Block or report Dm2998

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Maximum 250 characters. Please don't include any personal information such as legal names or email addresses. Markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
Dm2998/README.md

Typing SVG


👨‍💻 About Me

  • 🎯 I’m looking for a permanent entry-level role in technologies I continue learning, and to contribute as part of a team.
  • 🎓 I’m a recent graduate in Computing Science with Cloud IT Management from Technological University Dublin.
  • 🌱 I’m currently learning Go, MQTT, and Sensor integration to expand my full-stack and IoT development skills.
  • 📍 Based in Dublin, Ireland.
  • 💬 Passionate about clean code, problem-solving, and continuous learning in cloud, virtualization, and infrastructure technologies....

🧠 Tech Stack

Python MySQL HTML5 CSS3 JavaScript Linux PostgreSQL Perl Docker


🧩 Currently Learning

Go MQTT IoT



🤝 Connect With Me

LinkedIn Email



🌱 Continue Learning & Growing as a Developer

Here you’ll find a collection of resources, tutorials, and code examples I use to expand my knowledge in different technologies.
Take your time exploring and keep learning — Welcome!



📚Learn Python 🎉

📚 Explore the Python programming language with these beginner-friendly resources:

🔖 Python - Flask Tutorial
🔖 Python - Flask Tutorial 1
🔖 Python - Flask Tutorial 3
🔖 Python - Flask Tutorial 4
🔖 Python - Tutorial FastApi
🔖 Python - Tutorial FastApi 1
🔖 Python - Tutorial FastApi 1
🔖 Python - Tutorial Django
🔖 Python - Tutorial Everything


💻 PythonExample
import datetime

def name():
    name = input("What is your name?")  #ask the user for his name
    surname = input("What is your surname?") #ask the user for his surname
    print ("My name is" + " " + name + " " + surname) #print the name and surname
    
def address():
    address = input("Where do you live?") #ask the user for his address
    print ("I live in" + " " + address) #print the address

def college():
    college = input("Where do you study?") #ask the user for his college
    print ("I study in" + " " + college) #print the college
    
def course():
    course = input("What course are you doing?") #ask the user for his course
    print ("I am doing a" + " " + course) #print the course

def date_time():
    print(datetime.datetime.now()) #print the date and time

if __name__ == '__main__':
    name()
    address()
    college()
    course()
    date_time()

📚Learn AwK & Bash Notes 🎉

📚 Explore the Bssh with these beginner-friendly resources:
🔖 AWK - Tutorial

🔖 Bash - Tutorial
🔖 Bash - Tutorial 1


📚Learn Perl 🎉

📚 Explore the Perl programming language, with these beginner-friendly resources:

🔖 Perl-Tutorial 1
🔖 Perl-Tutorial 2
🔖 Perl-Tutorial 3
🔖 Perl-Tutorial 4
🔖 Perl-Tutorial 5

💻 Perl Example

Type Numeric String

The basic arithmetic operators in Perl are: +, -, *, /, %, and **. Comparison operators are used to compare two values and they return a boolean value. Perl provides several comparison operators that you can use to compare values. Comparison operators can be used for numeric and string values. These operators are: >, <, ==, !=, <=, >= for numeric values, and gt, lt, eq, ne, le, ge for string values.

  • Greater Than: > gt
  • Less Than: > gt
  • Not Equal: == eq
  • Not-Equel: != ne
  • Less than or equal to: <= le
  • Greater than or equal to: >= ge
#!/usr/bin/perl

# Get lengths of triangle sides from user
print "Enter the length of the first side: ";
my $a = <STDIN>;
print "Enter the length of the second side: ";
my $b = <STDIN>;
print "Enter the length of the third side: ";
my $c = <STDIN>;

# Calculate semi-perimeter
my $s = ($a + $b + $c) / 2;

# Calculate area using Heron's formula
my $area = sqrt($s * ($s - $a) * ($s - $b) * ($s - $c));

# Print area
print "The area of the triangle is $area\n";

# String Operators
$a=2;
$a=3;
print $a+$b   #arithmetic operator prints 5
print $a.$b   #string operator prints 2 plus the three or 23
print $a*$b   #arithmetic operator prints 6
print $a x $b #string operators prints $a $b times or 2 three times. i

# example 

my $a = "Apple";
my $b = "apple";
my $result = $a eq $b;
print $result; # false


JavaScript 🎉

📚 Essential tutorials to get started with JavaScript — from basics to advanced projects:

🔖 Javascript (46 class):
🔖 Curso de introduç ao Java script
🔖 Curso Java script básico
🔖 Curso Java Script
🔖 Att Java Script
🔖 JavaScript 1
🔖 JavaScript 2
🔖 JavaScript 3
🔖 JavaScript 4
🔖 JavaScript 5
🔖 Cursos de JavaScript
🔖 Playlist de projetos de JS
🔖 Fundamentos de JavaScript Funcional
🔖 Fundamentos de JavaScript Funcional
🔖 Fundamentos de JavaScript Funcional
🔖 Fundamentos de JavaScript Funcional
🔖 Fundamentos de JavaScript Funcional


🔖 [Learn JavaScript and More for Desing Website ](https://www.javatpoint.com/how-to-create-a-dynamic-table-in-javascript)


🔖 [Color - Desing Website ](https://cssgradient.io/shades-of-blue/)
🔖 [Color 1 - Desing Website ](https://www.w3schools.com/colors/color_tryit.asp?hex=F8F8FF)
🔖 [Color 2 - Desing Website ](https://www.w3schools.com/colors/colors_groups.asp#gsc.tab=0)
🔖 [Color 3 - Desing Website ](https://getbootstrap.com/docs/5.3/utilities/float/)
🔖 [Color 4 icon - Desing Website ](https://icons.getbootstrap.com/icons/sort-alpha-down/)
🔖 [Color 5 Remove BackGround - Desing Website ](https://www.remove.bg/upload)
🔖 [Color 6 Template - Desing Website ](https://bootstrapmade.com/)
🔖 [Color 7 Template - Desing Website ](https://cloudinary.com/guides/image-effects/creating-an-image-overlay-with-javascript)
🔖 [Color 8 Template - Desing Website ](https://templatemo.com/page/1)

💻 JavaScript Example 👀 Example of JavaScript.

function add(a, b) {                   // add() function adds two numbers and returns the sum.
    console.log(a + b);
    print("the sum is: " + a + b + "!");
  return a + b;
}

function subtract(a, b) {                // subtract() function subtracts two numbers and returns the difference.
    console.log(a - b);
    print("the difference is: " + a - b + "!");
    return a - b;
    }

function multiply(a, b) {                  // multiply() function multiplies two numbers and returns the product.
    console.log(a * b);
    print("the product is: " + a * b + "!");
  return a * b;
}   

function divide(a, b) {                      // divide() function divides two numbers and returns the quotient.                                             
    console.log(a / b);
    print("the quotient is: " + a / b + "!");
    return a / b;
    }

function increment(n) {                       // increment() function increments a number by 1.
    console.log(n += 1);
    print("the number is: " + n += 1 + "!");
    return n += 1;
    }

function decrement(n) {                       // decrement() function decrements a number by 1.
    console.log(n -= 1);
    print("the number is: " + n -= 1 + "!");
    return n -= 1;
    }

function makeInt(n) {                       // makeInt() function parses a string and returns an integer.
    console.log(parseInt(n, 10));
    print("the number is: " + parseInt(n, 10) + "!");
    return parseInt(n, 10);
    }

function preserveDecimal(n) {                 // preserveDecimal() function parses a string and returns a floating point number.
    print("the number is: " + parseFloat(n) + "!");
    return parseFloat(n);
    }




📚 Learn Typescript


📚 Top playlists to start programming in Typescript:
🔖 [Curso de Typescript](https://learnxinyminutes.com/typescript/)

📚 Learn jQuery


📚 Top playlists to start programming in jQuery:
🔖 [Curso de jQuery 1](https://www.youtube.com/playlist?list=PLoRfWwOOv4jzx5mQTbL_un5KSFEAhkm8K)

📚 Learn Angular


📚 Top playlists to start programming in Angular:

🔖 Curso de Angular 1



📚Learn Go


📚 Top playlists to start programming in Go:

🔖 Curso de GO 1
🔖 Curso de GO 2
🔖 Curso de GO Cryptographic


💻 👀 Example of Go

package main

import (
	"fmt"
)

var words = [][]string{
	{"break", "lake", "go", "right", "strong", "kite", "hello"},
	{"fix", "river", "stop", "left", "weak", "flight", "bye"},
	{"fix", "lake", "slow", "middle", "sturdy", "high", "hello"},
}

func search(w string) {
DoSearch:
	for i := 0; i < len(words); i++ {
		for k := 0; k < len(words[i]); k++ {
			if words[i][k] == w {
				fmt.Println("Found", w)
				break DoSearch
			}
		}
	}
}

func main() {
	search("lake")
}



dino gif:



📚Learn Turtle Python 🎉


🐢 Learn Python Turtle Graphics
🔖 [Turtle Tutorial](https://www.cs.unh.edu/~cs414/asn/asn5/cs414-a5.html)
🔖 [Turtle Tutorial2. Build to Video Game, University of Cambridge](https://www.museums.cam.ac.uk/school-sessions/writing-games-using-python-turtle)
🎨 Example: Shapes with Turtle 👀 Example of Trigonometry with Turtle Python.

import turtle

def draw_circle(turtle, color, size, x, y): #draw circle
    turtle.color(color)
    turtle.pensize(size)
    turtle.penup()
    turtle.goto(x, y)
    turtle.pendown()
    turtle.circle(size)
    turtle.end_fill()
    
def draw_triangle(turtle, color, size, x, y): #draw triangle
    turtle.color(color)
    turtle.pensize(size)
    turtle.penup()
    turtle.goto(x, y)      #x and y are the coordinates
    turtle.pendown()
    turtle.begin_fill()
    for i in range(3):        
        turtle.forward(100)
        turtle.right(120)
    turtle.end_fill()
    turtle.setheading(0)
    
def draw_square(turtle, color, size, x, y): #draw square
    turtle.color(color)
    turtle.pensize(size)
    turtle.penup()
    turtle.goto(x, y)
    turtle.pendown()
    turtle.begin_fill()
    for i in range(4):      #for loop to draw square
        turtle.forward(size * 2)   # size * 2 to make it bigger
        turtle.forward(100)     # 100 to make it bigger
        turtle.right(90)         # right 90 degrees
    turtle.end_fill()      #end fill
    turtle.setheading(0)

def draw_star(turtle, color, size, x, y): #draw star
    turtle.color(color)
    turtle.pensize(size)
    turtle.penup()
    turtle.goto(x, y)
    turtle.pendown()
    turtle.begin_fill()
    for i in range(5):          # for loop to draw star
        turtle.forward(size * 2)    
        turtle.forward(100)
        turtle.forward(size * 2)   # size * 2 to make it bigger
        turtle.right(144)
    turtle.end_fill()
    turtle.setheading(0)

def draw_spiral(turtle, color, size, x, y): #draw spiral
    turtle.color(color)
    turtle.pensize(size)
    turtle.penup()
    turtle.goto(x, y)
    turtle.pendown()
    turtle.begin_fill()
    for i in range(50):         # for loop to draw spiral
        turtle.forward(size * 2)
        turtle.forward(100)
        turtle.forward(size * 2)
        turtle.right(144)
    turtle.end_fill()
    turtle.setheading(0)

def draw_art(): #draw art final
    window = turtle.Screen()
    window.bgcolor("red")
    tri = turtle.Turtle()
    tri.shape("arrow")
    tri.color("green")
    draw_triangle(tri, "green", 100, 0, 0)  #draw triangle
    draw_square(tri, "green", 100, 0, 0)    #draw square
    draw_circle(tri, "green", 100, 0, 0)     #draw circle
    draw_star(tri, "green", 100, 0, 0)       #draw star
    draw_spiral(tri, "green", 100, 0, 0)     #draw spiral
    window.exitonclick()             #exit on click

Java 🎉


## 📚 Learn Java ☕
📚 Recommended tutorials to get started with Java:

🔖 Java Tutorial for Beginners
🔖 Maratona Java
🔖 Learn Java 8 Full Course in 9 Hours
🔖 Java Programming:
🔖 Frameworks de Java
🔖 Java Full Course
🔖 Curso de Java
🔖 Curso de Java 2
🔖 Curso de Java 3


Example: Shapes with Java

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}

public class input {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter your name: ");
        String name = scanner.nextLine();
        System.out.println("Hello " + name);
    }
}

public class address {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter your name: ");
        String name = scanner.nextLine();
        System.out.println("Enter your address: ");
        String address = scanner.nextLine();
        System.out.println("Hello " + name + " your address is " + address);
    }
}




📚 Learn C 🎉


📚 Top playlists to start programming in C:

🔖 Curso de C 1
🔖 Curso de C 2
🔖 Curso de C 3
🔖 Curso de C 4
🔖 Curso de C 5
🔖 Curso de C 6



Git & Github 🎉

📚Learn Git e Github


📚 Master version control and collaboration with these resources:

🔖 Git 4 Noobs
🔖 Comandos Git
🔖 Aprenda Git
🔖 Git School
🔖 Git Flow Cheatsheet

📚Git e Github Commands


📘 Common Git Commands
💻 Essential Terminal Commands
These commands are used for navigating and managing files and directories on your operating system (Windows, macOS, Linux).

Command	
ls	          List files and folders in the current directory (Common on Unix/Linux/macOS).
dir	          List files and folders in the current directory (Common on Windows).
tree /f	      See a tree structure of what's inside the directory (Common on Windows).
cd ..	        Go back one directory level.
mkdir         (folder_name)


⚙️ Git Setup and Initial Configuration
These steps are typically done once when you first start using Git on a new machine.

Install Git	Site for install Git	Download and install Git for your operating system.

Set Username: 	git config --global user.name "Your Name" 	       Configure your global username for commits.
Set Email:     	git config --global user.email "[email protected]"	   Configure your global email for commits.

🗂️ Git Repository Management
These commands are used to create, link, and get a Git repository.
Command	
git init	                Initialize versioning in the current directory, creating a new local Git repository.
git clone <link>	        Clone an existing repository from a remote URL to your local machine.
git remote                add origin <link>


✅ Git Basic Workflow
This is the standard process for saving changes (committing) in Git.

Command	
git status	                                        Check the current state of the repository (shows modified, staged, and untracked files).
git add . or git add -A	                            Add all changes (new, modified, deleted) to the staging area.
git commit -m "Your descriptive message"	          Commit the staged changes with a descriptive message.
git commit -am "Message"	                          Add all tracked and modified files to the staging area and commit them in one step.


➡️ Git Collaboration & SyncingThese commands are used to interact with the remote repository (e.g., on GitHub).
Command
push origin <branch>                                    Push your local committed changes to the specified remote branch.
git pull origin <branch>Pull (fetch and merge)          changes from the remote branch into your current local branch.



🌳 Git Branching and MergingThese commands are essential for managing separate lines of development.
Command
igt branchView                                                   All existing local branches.
git checkout <branch>                                            Switch to an existing branch.
git checkout -b <new-branch-name>                                Create a new branch and immediately switch to it.
git merge <branch-to-merge>                                      Merge the specified branch into your current branch.
git branch -d <branch-name> or git branch -D <branch-name>       Delete a local branch (use -D for an unmerged branch).
git push origin :<branch-name>                                   Delete a remote branch.


🔍 Git Inspection and HistoryThese commands help you look at the history and compare changes.
Command
git log                      List the history of commits.
git log --oneline            List the history with a concise hash and commit title.
git diff                     Check the un-staged changes between your working directory and the last commi.
git diff --name-only         Check only the names of the files that have changed.
git diff <file-name>         Check only the changes made to a specific file.
git diff --staged            Check changes in the staging area.

⏪ Git Undoing Changes (Reset)
These commands allow you to revert or modify history.

Command
git reset --soft <commit-hash>                            Undoes commits but keeps all changes staged (git status shows files ready to commit).
git reset --mixed <commit-hash>                           Undoes commits and un-stages all changes (git status shows files modified). This is the default.
git reset --hard <commit-hash>                            Undoes commits and discards all changes in the working directory (use with caution).


📚Selenium Webdriver Commands.


🚀 Setting Up Selenium WebDriver and ChromeDriver.

The most common cause of errors in Selenium is a mismatch between the Chrome Browser version, the ChromeDriver executable version, and the Selenium WebDriver library version.

1. Update Selenium WebDriver (The Library)
Always ensure the Selenium library itself is the latest version. This command updates the code your tests use to communicate with the browser.

Command	Description
npm install selenium-webdriver@latest	                 Installs the latest version of the core Selenium library into your project.


Use Selenium Manager (Recommended for Selenium v4.6+)
Recent versions of selenium-webdriver (v4.6.0 and newer) include Selenium Manager. This tool automatically downloads and manages the correct ChromeDriver version for your installed Chrome browser. You usually don't need to install chromedriver separately at all.

In your code (Node.js):

If you are using Selenium Manager, your code should automatically find the driver:

const { Builder } = require('selenium-webdriver');
const driver = await new Builder().forBrowser('chrome').build();
// Selenium Manager automatically finds the correct ChromeDriver path.


B. Use a Third-Party Package (Alternative for older versions)
If you must manage the driver yourself, use a package like webdriver-manager or chromedriver to handle installation and versioning.

npm install --save-dev chromedriver                  Installs the chromedriver executable as a project dependency.


3. Troubleshooting: Checking Your Dependencies
Your current dependencies show this potential issue:
selenium-webdriver	        4.9.0	           Modern version that supports Selenium Manager.
chromedriver	             112.0.0	         This is a specific, older version (Chrome 112).

Potential Issue: If your Chrome browser has updated to a newer version (e.g., Chrome 120+), the explicit [email protected] will be too old, leading to compatibility errors.
Update chromedriver to the latest version, which usually matches the latest Chrome browser.

npm update chromedriver                     Updates chromedriver to its latest available version on npm.


Update Selenium Webdriver:
It seems like your Selenium Webdriver version might be outdated. Try updating it to the latest version by running the following command:

npm install selenium-webdriver@latest


Check Chromedriver Compatibility:
Ensure that your installed Chromedriver version is compatible with your Chrome browser. You can manually download the Chromedriver executable from the official Chromedriver download page and replace the existing Chromedriver executable in your project's node_modules/selenium-webdriver/chrome directory.


npm install -g chromedriver


Specify Chromedriver Version:
If the issue persists, you can try specifying the Chromedriver version in your package.json file. Add the following line:
You can find the available versions on the npm Chromedriver page.
npm install chromedriver

npm test


├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]


<br>

 Let's go through the steps to resolve this issue:

Check package.json for "scripts" section:
Open your package.json file and make sure it contains a "scripts" section. If it doesn't exist, add it:

json
"scripts": {
  "start": "your-start-command-here"
}
Replace "your-start-command-here" with the actual command you want to run when you start your project.

Verify npm version:
Ensure you have a recent version of npm installed. Run the following command to check your npm version:

bash
npm -v
If your npm version is outdated, you can update it using:

bash
npm install -g npm@latest
Install dependencies:
If you recently created the project or cloned it from a repository, make sure to install the dependencies. Run the following command in your project directory:

bash
npm install
This will install the dependencies specified in your package.json.


📚Mongodb

📚 Useful commands to get started with MongoDB:


🔖 [Mongodb - Tutorial ](https://www.tutorialspoint.com/mongodb/index.htm)
🔖 [Mongodb - Tutorial 1 ](https://riptutorial.com/Download/mongodb.pdf)

Mongo DB

🛠️ MongoDB Shell Basics: Installation & Core Commands

1. Installation and Access
Before running any commands, you need to install MongoDB and access the shell.


Download MongoDB.	  Download and install the MongoDB Community Server edition for your operating system from the official MongoDB website.	This includes the server and the necessary tools.


Start the Server.	      Ensure the MongoDB daemon (mongod) is running in the background.	On most systems, this starts automatically or is run via a service.


Access the Shell.          	Open your terminal/command prompt and issue the command to launch the MongoDB Shell.	mongosh is the modern command line interface. The legacy command was mongo.


mongosh.       	Launch the MongoDB Shell	Connects to the default local MongoDB server running on port 27017.


2. 🗄️ Database Management Commands
These commands allow you to see, switch between, and create databases.

Command	Description	Example Output
db            	Report the name of the database currently in context for your session.
test (or the name of the database you last used)

show dbs                   (or show databases)	List all databases that contain at least one document (i.e., that have been permanently created).

use <database_name>	        Switch your session's context to the specified database. If the database doesn't exist, MongoDB creates a reference to it.

📝 Important Note on Database Creation
MongoDB does not permanently create a database (meaning it won't show up in show dbs) until you insert data (e.g., a document into a collection) within that database's context.

Example Flow:
use myTempDB $\implies$ Database reference created.
show dbs $\implies$ myTempDB is NOT listed.
db.users.insertOne({ name: "Alice" }) $\implies$ Data inserted.
show dbs $\implies$ myTempDB IS NOW listed.

3. 📚 Collection Management Commands
Collections are the equivalent of tables in a relational database, holding your documents (records).

show collections	                             Display a list of all collections within the current database context (db).

db.createCollection("<collection_name>")	    Explicitly create a new collection (optional, as collections are created automatically upon first insert).

db.<collection_name>.drop()	                   Delete an entire collection from the current database.

Example:

Assuming you have switched to the myNewProjectDB context:
show collections $\implies$ Lists: users, products, ordersdb.
products.drop() $\implies$ Deletes the products collection.

4. ✍️ Basic Data Operations (CRUD)
These are the fundamental commands for interacting with documents (your data records) within a collection.

CREATE (Insert)	             db.<collection>.insertOne()	              db.users.insertOne({ name: "Bob", age: 30 })

READ (Query)	            db.<collection>.find()	                      db.users.find() (shows all documents)
   
UPDATE                   db.<collection>.updateOne()	                  db.users.updateOne({ name: "Bob" }, { $set: { age: 31 } })

DELETE	                    db.<collection>.deleteOne()               	db.users.deleteOne({ name: "Bob" })


🔍 The .find() Method: Querying Documents
The .find() method accepts two main parameters:

db.<collectionName>.find(<query>, <projection>)

# <query> (Mandatory): A document that specifies the selection criteria (i.e., the conditions documents must meet to be returned). If you pass an empty document ({}), it returns all documents in the collection.

# <projection> (Optional): A document that specifies which fields to include or exclude in the result set.

1. Simple Equality Queries
To find documents where a field exactly matches a value, use the structure { <field>: <value> }.


Example Query:
db.users.find({ age: 30 })                	              Finds all documents in the users collection where the age field is exactly 30.

db.products.find({ category: "Electronics" })	            Finds all products categorized as Electronics.

db.orders.find({ "customer.id": 123 })	                  Finds all orders where the nested field customer.id is 123.


2. Comparison Operators
MongoDB uses comparison operators (prefixed with $) to perform non-equality checks.

Operator Example Query
$gt	         Greater Than	                             db.items.find({ price: { $gt: 50 } })
$gte	       Greater Than or Equal	                   db.items.find({ quantity: { $gte: 10 } })
$lt	         Less Than	                               db.items.find({ stock: { $lt: 5 } })
$lte	       Less Than or Equal	                       db.items.find({ score: { $lte: 90 } })
$ne	         Not Equal to	                             db.users.find({ status: { $ne: "Archived" } })
$in	         Value in an array of possibilities	       db.users.find({ country: { $in: ["USA", "Canada"] } })
$nin	        Value not in an array of possibilities	 db.users.find({ country: { $nin: ["Mexico", "Brazil"] } })

3. Logical Operators
You can combine multiple criteria using logical operators.

Operator	Description	Example Query
$and	       Requires all conditions to be true (usually implicit).     db.users.find({ age: { $gt: 25 }, status: "active" })
$or          Requires at least one condition to be true.	              db.users.find({ $or: [ { age: 25 }, { status: "pending" } ] })
$not	       Inverts the effect of a query expression.                 	db.users.find({ age: { $not: { $gt: 50 } } }) (Age is 50 or less)
$nor	       Requires none of the conditions to be true.	              db.users.find({ $nor: [ { age: 25 }, { status: "pending" } ] })

Example of $and (Implicit): The query { age: { $gt: 25 }, status: "active" } is equivalent to: { $and: [ { age: { $gt: 25 } }, { status: "active" } ] }


4. Projection (Selecting Fields)
The optional second argument in .find() is the projection, which controls the shape of the documents returned. This is key for performance, as you only retrieve necessary data.

To include a field, set its value to 1.

To exclude a field, set its value to 0.

The _id field is included by default unless explicitly excluded.

Example Query	
db.users.find({}, { name: 1, email: 1 })	               Return only the name, email, and _id fields.
db.users.find({}, { _id: 0, name: 1, email: 1 })	       Return only the name and email fields (excluding _id).
db.users.find({}, { password: 0 })	                     Return all fields except the password.

5. Cursor Modifiers
The .find() method returns a cursor, which you can chain methods onto to refine the results.


Command	Description	Example
.limit(<n>)	          Restrict the number of documents returned.	                          db.products.find().limit(10)
.skip(<n>)	          Skip a specified number of documents (used for pagination).     	   db.products.find().skip(20).limit(10)
.sort(<field: 1/-1>)	Sort the results (1 for ascending, -1 for descending).	             db.products.find().sort({ price: -1 })
.count()	     Return the total number of documents matching the query (used instead of .find()).  	 db.products.count({ inStock: true })







💖 Contributions Are Welcome!.






@Dm2998's activity is private