Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

From the collection 'res Mongodb with restaurants database Make sure the restaurant database is imported into your MongoDB server. You can download it from here

From the collection 'res Mongodb with restaurants database
Make sure the restaurant database is imported into your MongoDB server.
You can download it from here (restaurants.json darr ), then import it to your server.
FYI, an example of a document in the restaurants dataset is as follows."address": { "building": "1007",
"coord": [-73.856077,40.848447],
"street": "Morris Park Ave", "zipcode": "10462"
},
"borough": "Bronx",
"cuisine": "Bakery", "grades": [
{ "date": {"$date": 1393804800000}, "grade": "A", "score": 2},
{ "date": {"$date": 1378857600000}, "grade": "A", "score": 6},
{ "date": {"$date": 1358985600000}, "grade": "A", "score": 10},
{ "date": {"$date": 1322006400000}, "grade": "A", "score": 9},
{ "date": {"$date": 1299715200000}, "grade": "B", "score": 14}
],
"name": "Morris Park Bake Shop", "restaurant_id": "30075445"
}[2.5pts/each] From the collection 'res
queries.
For each of the following queries, show MongoDB MQL command and its results. For each query, show the first
5 documents only.
Run the commands using mongosh (not MongoDB Compass). You can check the results of commands using
MongoDB Compass, though.
Show the first 5 restaurants which are in the borough of
Show the restaurants which do not serve any cuisine of 'Chinese' and received a grade point 'B'. The results
should be sorted based on cuisine in descending order.
Show the fields restaurant_id, name, cuisine, and borough, but don't include _id for the first 5 restaurants.
Show the next 5 restaurants after skipping the first 5 which are in the borough
Show the restaurants located in the borough of Manhattan and prepare either American or Chinese dishes.
Show the restaurants that achieved a score of more than 90 but less than
Show the restaurant_id, name, borough, and cuisine for those restaurants that belong to the borough of
Staten Island or Queens or Bronx or Brooklyn.
Show the restaurant_id, name, borough, and cuisine for those restaurants that do not belong to the
borough of Staten Island or Queens or Bronx or Brooklyn. B. MongoDB with your own table
create your database and collection
Create your own database and collection in MongoDB (using MongoDB Compass or mongosh). Use proper
name for database and collection.
choose ONE table from your term project MySQL database (only one table with at least 5 attributes). If
your table has less than 5 attributes, add mode attributes.
[2pts] Show the contents of the original table in your MySQL table
Now in the table, assume you add a new attribute and fill the attribute with an array of numbers. For
example, in the figure below, you add a new attribute E and fill the attribute with an array of values such as
{4,7,2},{1,6}...(Don't actually insert attribute/data in your MySQL table. Actual insertions will be done in
steps 5-6. If your table has less than 12 records, add more records. Ensure the data values are diverse so
you can run queries in Q. B-2.
Represent the contents in Figure (b) in JSON format
Using MongoDB Compass, import the JSON file into your collection or you can manually insert documents
using insertMany()(slide 43)
[8pts] Show the contents of your collection (using find())[2pts/each] Execute ONE MQL command for each of the following Show a) the query in plain English (explain
what this query is about), b) the corresponding MQL command, and c) the results of the command
use projection
use comparison operator
use $and and $or operator
use $all operator
use $elemMatch operator
queries.
For each of the following queries, show MongoDB MQL command and its results. For each query, show the first
5 documents only.
Run the commands using mongosh (not MongoDB Compass). You can check the results of commands using
MongoDB Compass, though.
Show the first 5 restaurants which are in the borough of
Show the restaurants which do not serve any cuisine of 'Chinese' and received a grade point 'B'. The results
should be sorted based on cuisine in descending order.
Show the fields restaurant_id, name, cuisine, and borough, but don't include _id for the first 5 restaurants.
Show the next 5 restaurants after skipping the first 5 which are in the borough
Show the restaurants located in the borough of Manhattan and prepare either American or Chinese dishes.
Show the restaurants that achieved a score of more than 90 but less than
Show the restaurant_id, name, borough, and cuisine for those restaurants that belong to the borough of
Staten Island or Queens or Bronx or Brooklyn.
Show the restaurant_id, name, borough, and cuisine for those restaurants that do not belong to the
borough of Staten Island or Queens or Bronx or Brooklyn.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

=+(2.9) PUAK =EP(A) - EP(ANA,) k=1 i

Answered: 1 week ago