Skip to main contentSkip to footer

Answer for Homework 2.1 M101JS Courseware

Rupak Nepali
Share:
Answer for Homework 2.1 M101JS Courseware

HOMEWORK: HOMEWORK 2.1

In this problem, you will be using an old weather dataset. Download weather_data.csv from the Download Handout link. This is a comma separated value file that you can import into MongoDB as follows:

mongoimport –type csv –headerline weather_data.csv -d weather -c data

You can verify that you’ve imported the data correctly by running the following commands in the mongo shell:

> use weather
> db.data.find().count()
> 2963

Reading clockwise from true north, the wind direction is measured by degrees around the compass up to 360 degrees.

90 is East

180 is South

270 is West

360 is North

Your assignment is to figure out the “State” that recorded the lowest “Temperature” when the wind was coming from the west (“Wind Direction” between 180 and 360). Please enter the name of the state that meets this requirement. Do not include the surrounding quotes in providing your answer.

Answer is:
New Mexico

Write New Mexico and submit.

If you need query then following is the query to retrieve the data

db.data.find({"Wind Direction":{$gte:180,$lte:360}}, {"State":true,"Temperature":true, "_id":false, "Wind Direction":true}).sort({"Temperature":1})

 

Comments

Join the conversation and share your thoughts

Leave a Comment

Your comment will be reviewed before publishing.

Be the first to comment on this post!

Innovation

Let's Make Something Amazing Together

We always provide our best creative ideas at the highest level. Tell us about your project and we will make it work.

InnovateBringing innovative solutions to complex problems
AutomateStreamlining processes through automation
DominateLeading the market with exceptional results
Build Smarter and Launch FasterEfficient development for rapid deployment