/mongo-pokemon

[nosql, mongodb, databases, exercise]

OtherNOASSERTION

Mongo Pokemon Lab

Time for some Pokemon query fun in the MongoDB console...

  • First, grab the seed.json file from your repo.
  • Next, import it into MongoDB using the mongoimport feature. Make sure you're in the directory that includes the file before running this command in the terminal:

mongoimport -d pokemon -c pokemons --jsonArray < seed.json


Helpful Mongo Commands

Command Description
brew services Start or Stop MongoDBserver
mongo Start a MongoDB Shell (client)
show dbs Show a list of Databases
use <database_name> Set your current database
db Verify your current database
show collections Show the collections in the current DB
db.<collection_name>.find() Query a particular collection
.pretty() Make a JSON Object 'pretty'

Also, be sure to check the MongoDB docs.


Pokemon Queries

STEP 1 - Print all the Pokemon names to the MongoDB console like so name: <name_of_pokemon>.

STEP 2 - Find the Pokemon with the name "Mew".

STEP 3 - How many Pokemons are 87.5 male?

STEP 4 - How many Pokemons have ice : "2"?

STEP 5 - How many Pokemons have ice : "2" AND female : "12.5"?

STEP 6 - How many Pokemons have "speed": "60" OR "type" : "Grass"?

STEP 7 - How many have BOTH "speed": "60" AND "type" : "Grass"?

STEP 8 - Create a new collection named Schmittymons and add a new Schmittymon with the folowing traits: