HOMEWORK 4.4 MONGODB
This homework is meant to give you practice using the “package. Then you can iterate through the documents and know that whenever the state changes you have reached the highest temperature for that state. Let’s see what Tamika Schildgen’s record looks like: This is a sample document from the weather data collection: Now query the profile data, looking for all queries to the students collection in the database school2, sorted in order of decreasing latency. Please provide the value corresponding to the “answer” key without the surrounding quotes from the document returned.
Calling ‘npm install’ with no specific package tells npm to look for ‘package. Workspace info , updated a year ago mongodb-courses-mjs. Note you will need to have your path setup correctly to find mongorestore. From the top of this page, there was one additional program that should have been downloaded: The blog stores its data in the blog database in two collections, users and sessions. This is a comma separated value file that you can import into MongoDB as follows:
Let us count the number of students we have: You should see four files in the ‘blog’ directory: Do this by opening a terminal window mac homewotk cmd window windows and navigating to the directory so that the dump directory is directly beneath you.
Web applications development : MongoDB for developers 4/8. Performance. Homeworks
There is also a ‘views’ directory which contains the templates for the project and a ‘routes’ directory which contains our express routes. When you login or sign-up, the blog will redirect to http: Note you will need to have your path setup correctly to find mongorestore.
Then install all the dependencies listed in the ‘package. The database calls that you are going to add will add a new user upon sign-up and validate a login by retrieving the right user document. In this homework assignment you will be adding some indexes to homdwork post collection to make the blog fast. After you run the blog, you should see homeaork message:.
To confirm you are on the right track, here are some queries to run after you process the data with the correct answer shown:. This is a comma separated value file that you can import into MongoDB as follows:.
Note that this is only an example and not the actual document that you would be updating. You should not need to touch any other code. This assignment requires Mongo 2.
Hello from MongoDB!
Then install the mongodb driver: With it, you can test your code and look at the Feedback section. The blog has been enhanced so that it can also display the top 10 most recent posts by tag. Let’s see what Tamika Schildgen’s hojework looks like: There are entries with lots of comments and tags.
Since there is a single document for each student containing an array of scores, you will need to update the scores array and remove the homework.
If you have all the dependencies installed correctly, this will print the message ‘Express server started on port ‘. Once you have added the mongofb to make those pages fast, just validate your work with MongoProc.
To start, please download sysprofile. You will need to download one of the following versions of the MongoProc client, mongodbb will verify on your local machine port that the signup and login pages of the blog work properly.
Change directory into hw1 Use mongorestore to restore the dump into your running mongod. By fast, we mean that indexes should be in place to satisfy these queries such that we only need to scan the number of documents we are going to return.
If you select all the weather documents, you can sort first by state, then by temperature. There are hyperlinks from the post tags to the page that displays the 10 most recent blog entries for that tag.
Here are some URLs that must work when you are done. Remember, just remove a homework score.
One way is to find the lowest homework in code and then update the scores array with the low homework pruned.
After you run the blog, you should see the message: When it says “user creation successful” and “user login successful”, you can Turn in your assignment.
To figure out what queries you need to optimize, you can read the code in posts.