Kayıtlar

Nisan 14, 2015 tarihine ait yayınlar gösteriliyor

M101N: MONGODB FOR .NET DEVELOPERS questions 1.3

HOMEWORK: HOMEWORK 1.3 This homework assignment is designed to ensure that you have Visual Studio set up and ready to go for next week, when you'll need it. Download and extract the handout. Run it in Visual Studio, and to make sure that you've got everything set up, it will post a number at localhost:61245 . You can view it in your browser. Please input that number into the box below to demonstrate that you have Visual Studio set up. There should be no characters except numbers, and perhaps a minus sign. Do not include spaces. Do not include a decimal place. Answer is -1030

M101N: MONGODB FOR .NET DEVELOPERS questions 1.2

HOMEWORK: HOMEWORK 1.2 Which of the following are valid JSON documents? Please choose all that apply. { "a" : 1, "b" : { "b" : 1, "c" : "foo", "d" : "bar", "e" : [1, 2, 4] } } { "city" = "New York", "population" = 7999034, "boroughs" = ["queens", "manhattan", "staten island", "the bronx", "brooklyn"] } {} { "name" : "Fred Flinstone" ; "occupation": "Miner" ; "wife" : "Wilma" } { "title" : "Star Wars", "quotes" : [ "Use the Force", "These are not the droids you are looking for" ], "director" : "George Lucas" }

M101N: MONGODB FOR .NET DEVELOPERS questions 1.1

HOMEWORK: HOMEWORK 1.1 Install MongoDB on your computer and run it on the standard port. Download the HW1-1 from the Download Handout link and uncompress it. Use mongorestore to restore the dump into your running mongod. Do this by opening a terminal window (mac) or cmd window (windows) and navigating to the directory so that you are in the parent directory of the dump directory (if you used the default extraction method, it should be hw1/). Now type: mongorestore dump Note you will need to have your path setup correctly to find mongorestore. Next, go into the Mongo shell, perform a findOne on the collection called  hw1  in the database m101 . That will return one document. Please provide the value corresponding to the "answer" key from the document returned. Answer is 42

M101N: MONGODB FOR .NET DEVELOPERS questions 2.2

HOMEWORK: HOMEWORK 2.2 Write a program in the language of your choice that will remove the grade of type "homework" with the lowest score for each student from the dataset in the handout. Since each document is one grade, it should remove one document per student. This will use the same data set as the last problem, but if you don't have it, you can download and re-import. The dataset contains 4 scores each for 200 students. First, let’s confirm your data is intact; the number of documents should be 800. > use students > db.grades.count() 800 Hint/spoiler : If you select homework grade-documents, sort by student and then by score, you can iterate through and find the lowest score for each student by noticing a change in student id. As you notice that change of student_id, remove the document. To confirm you are on the right track, here are some queries to run after you process the data and put it into the  grades  collection: Let us count the number of

M101N: MONGODB FOR .NET DEVELOPERS questions 2.1

HOMEWORK: HOMEWORK 2.1 In this problem, you will be using a collection of student scores that is similar to what we used in the lessons. Please download grades.json from the Download Handout link and import it into your local mongo database as follows: mongoimport -d students -c grades < grades.json The dataset contains 4 scores for 200 students. First, let’s confirm your data is intact; the number of documents should be 800. > use students > db.grades.count() 800 This next query, which uses the aggregation framework that we have not taught yet, will tell you the student_id  with the highest average score: > db.grades.aggregate({'$group':{'_id':'$student_id', 'average':{$avg:'$score'}}}, {'$sort':{'average':-1}}, {'$limit':1}) The answer should be  student_id  164 with an average of approximately 89.3. Now it’s your turn to analyze the data set. Find all exam scores greater than or equal to 65, a

M101N: MONGODB FOR .NET DEVELOPERS questions 4.3

HOMEWORK: HOMEWORK 4.3: MAKING THE BLOG FAST (MONGOPROC) Please download the handouts to get started. This assignment requires MongoDB 3.0 or above for your server. In this homework assignment you will be adding some indexes to the post collection to make the blog fast. We have provided the full code for the blog application and you don't need to make any changes, or even run the blog. But you can, for fun. We are also providing a generated data set with 10000 entries with comments and tags. You must load this dataset to complete the problem. Unzip the mongodump handout. You should see a "dump" directory in your working directory; the "dump" directory contains your mongodump. First, begin by dropping your blog database, and loading the sample data and taking a look: echo "db.dropDatabase()" | mongo blog mongorestore dump mongo blog Now your 'blog' database should contain 10,000 blog posts (randomly generated) in the 'posts'

M101N: MONGODB FOR .NET DEVELOPERS questions 4.4

HOMEWORK: HOMEWORK 4.4 In this problem you will analyze a profile log taken from a mongoDB instance. To start, please download sysprofile.json from Download Handout link and import it with the following command: mongoimport -d m101 -c profile < sysprofile.json Now query the profile data, looking for all queries to the  students  collection in the database school2 , sorted in order of decreasing latency. What is the latency of the longest running operation to the collection, in milliseconds? 19776550 10000000 5580001 15820 2350

M101N: MONGODB FOR .NET DEVELOPERS questions 4.1

HOMEWORK: HOMEWORK 4.1 Suppose you have a collection with the following indexes: > db.products.getIndexes() [ { "v" : 1, "key" : { "_id" : 1 }, "ns" : "store.products", "name" : "_id_" }, { "v" : 1, "key" : { "sku" : 1 }, "unique" : true, "ns" : "store.products", "name" : "sku_1" }, { "v" : 1, "key" : { "price" : -1 }, "ns" : "store.products", "name" : "price_-1" }, { "v" : 1, "key" : { "description" : 1 }, "ns" : "store.products", "name" : "description_1" }, { "v" : 1, "key" : { "category" : 1, "brand" : 1 }, "ns" : "store.products", "

M101N: MONGODB FOR .NET DEVELOPERS questions 4.2

HOMEWORK: HOMEWORK 4.2 Suppose you have a collection called  tweets  whose documents contain information about the created_at  time of the tweet and the user's  followers_count  at the time they issued the tweet. What can you infer from the following  explain  output? > db.tweets.explain("executionStats").find({"user.followers_count":{$gt:1000}}).limit(10).skip(5000).sort( { created_at : 1 } ) { "queryPlanner" : { "plannerVersion" : 1, "namespace" : "twitter.tweets", "indexFilterSet" : false, "parsedQuery" : { "user.followers_count" : { "$gt" : 1000 } }, "winningPlan" : { "stage" : "LIMIT", "limitAmount" : 0, "inputStage" : { "stage" : "SKIP", &quo