MongoDB Intro
Download mongoDB compass
Windows
https://www.mongodb.com/try/download/community
https://www.mongodb.com/products/tools/compass
Mac
Run the following in terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
If you have Homebrew:
brew tap mongodb/brew
brew install mongodb-community
Start it as a background service:
brew services start mongodb-community
Import the dataset
https://github.com/nicklasdean/data/blob/main/pokemon.json
Read the documentation
https://www.mongodb.com/docs/manual/tutorial/query-documents/
Query Operators
https://www.mongodb.com/docs/manual/reference/operator/query/#std-label-query-selectors
A)
Retrieve all pokemon of type "Water" (either in type1 or type2)
B)
Retrieve all pokemon that has an attack greater than 100
C)
Retrieve all pokemon from generation 1-3
D)
Retrieve all Pokémon with a type1 of either "grass" or "fire" and with an attack value greater than 50.
E)
Retrieve all pokemon that are either water-type or grass type from generation 1 or 2
F)
Find all Pokémon that have more than one ability.
Hint: In this dataset, the field abilities is stored as text (for example: "['Overgrow', 'Chlorophyll']").
What can we look for to understand whether there is multiple abilities?
Advanced Optional
G)
Find all Pokémon that have the ability "Overgrow" or "Blaze" and a speed greater than 90
H)
Find all pokemon with the following criteria:
They are either of type "electric" or "psychic".
They have an attack value greater than 70.
Their base happiness is greater than 50.
They belong to generation 1 or 2.
They do not have any abilities containing the word "Intimidate".
Last updated