please follow instructions in the pdf
Microsoft Word - CM3104-2018-Coursework.docx 1 CardiffSchoolofComputerScienceandInformatics CourseworkAssessmentforCM3104LargeScaleDatabases ModuleCode:CM3104 ModuleTitle:LargeScaleDatabases Lecturer:C.B.Jones,A.I.Abdelmoty,J.Shao AssessmentTitle:Coursework1 AssessmentNumber:1 DateSet:Thursday1stNovember2018 SubmissionDateandTime:Wednesday5thDecember2018at9:30am. ReturnDate:Week12,Friday11thJanuary2019. Thisassignmentisworth30%ofthetotalmarksavailableforthismodule.Thepenaltyfor lateornon-submissionisanawardofzeromarks. YoursubmissionmustincludetheofficialCourseworkSubmissionCoversheet,whichcanbe foundhere: https://docs.cs.cf.ac.uk/downloads/coursework/Coversheet.pdf SubmissionInstructions Description Type Name Cover sheet Compulsory One PDF (.pdf) file [student number].pdf PART A Compulsory One PDF (.pdf) file comprising your answer to all questions with snapshots of the mongodb shell as explained below. PartA_[student number].pdf Compulsory The javascript file with your answer to all the questions in Task 2. PartA_[student number].js PART B Compulsory One PDF (.pdf) file that contains answers to all questions. PartB_[student number].pdf PART C Compulsory One PDF (.pdf) file that includes for each of the five answers to Part C: 1 - The Oracle SQL query; 2 – The answer to the query; 3 - A screen shot of: the query in Oracle followed by the Oracle output from the query. PartC_[student number].pdf Anydeviationfromthesubmissioninstructionsabove(includingthenumberandtypesof filessubmitted)mayresultinamarkofzerofortheassessmentorquestionpart. 2 CourseworkPARTA:NoSQLDatabases[worth10marks] Inthispartofthecourseworkyouwillmakeuseoftwodatasets:arestaurantsdataset(in thefile,restaurants.js)andazipcodesdataset(inthefilezipcodes.js).Youarebuildingan applicationwithMongoDBthatwillusebothdatasetstofindinformationaboutrestaurants indifferentcities. Anexamplerecordfromtherestaurantsdatasetis: { "_id":ObjectId("55cba2476c522cafdb053ae8"), "location":{ "coordinates":[ -73.9973325, 40.61174889999999 ], "type":"Point" }, "name":"C&CCateringService" } Anexamplerecordfromthezipcodesdatasetis: { "_id":"01002", "city":"CUSHMAN", "loc":[ -72.51565, 42.377017 ], "pop":36963, "state":"MA" } Hereisamapofasamplefromtherestaurantsdataset. 3 Task1 ImportbothdatasetsintoMongoDBinONEdatabase.Eachdatasetshouldbestoredina separatecollection.Forexample,youcouldbuilda“services”databasewithtwo collections:“restaurants”and“zipcodes”. (1mark) Task2 1. FindallthePizzarestaurantsinthedatasetandcounttheirnumber. APizzarestaurantisanyrestaurantwhichhastheword“Pizza”initstitle. (1mark) 2. ForeachPizzarestaurantfromtheaboveset,findthecitythatitislocatedin. Youcanassumethatarestaurantislocatedinthenearestcitytoitslocation. (2marks) 3. Inyourapplicationyouwillneedtoretrievetherestaurantsandtheirassociated citiesfrequently. Createanewcollection(“geodb”)thatcontainsallthedataintherestaurant collection,butforeveryrestaurantdocumentinthenewcollection,addan additionalfield“city”whosevalueistheclosestcitytotherestaurant’slocation.Use thesamemethodoffindingthecityasyouhavedoneinquestion2. Documentsinyournew“geodb”collectionshouldbesimilartothefollowing: { "_id":ObjectId("55cba2476c522cafdb053ae8"), "location":{ "coordinates":[ -73.9973325, 40.61174889999999 ], "type":"Point" }, "name":"C&CCateringService", "city":"BROOKLYN" } (3marks) 4 4. Querythenew“geodb”collectiontofindrestaurants,groupedbycity.Youranswer shouldinclude:cityname,numberofrestaurantsinthecityandalistofallthe namesoftherestaurantsinthecity. Anexampledocumentoftheresultsofthisqueryisasfollows: { "City":"MOBILE", "NoofRestaurants":3, "Restaurants":[ "IslandSoftPretzelStop", "DairyQueenGrill&Chill", "StatueOfLibertyDeli" ] } (2marks) 5. Adifferentmethodofstoringtherestaurantandcityinformationtogetherisby modifyingtheoriginal“zipcodes”collectionbyaddingafield“restaurantsInCity” whosevalueisanarrayofalltherestaurantsthatarelocatedinthecity.An exampleofadocumentinthemodified“zipcodes”collectionisasfollows: { "_id":"36607", "city":"MOBILE", "loc":[ -88.1029, 30.697486 ], "pop":8610, "state":"AL" “restaurantsInCity”:[“IslandSoftPretzelStop”,“DairyQueenGrill&Chill”,"Statue OfLibertyDeli"] } ExplainwhetherthisisasensiblemodellingoptioninMongoDB,byreferringtoits effectivenessforstoringandretrievingtheinformationaboutrestaurantsand associatedcities. (1mark) 5 UPLOADSFORPARTA 1. SaveyouranswertothequestionsinTask2inajavascriptfilewiththename: PartA_[studentnumber].js 2. SaveyouranswertoallquestionsinTask1andTask2inapdffile: PartA_[studentnumber].pdf.Youcantakeasnapshotofthequestionbeing executedintheMongoDBshell,clearlydemonstratingtheanswertothequestion (includesnapshotsofallintermediatestepsasappropriate).Asampleoftheresults issufficient–thisshouldbethefirst5documents.Anexampleofasufficient snapshotoftheanswertoaquerytofindallrecordsinthe“zipcodes”collectionisas follows.