Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Introduction This week you will be designing the database for the Food Order App in MongoDb. You will create collections, insert documents and retrieve records

Introduction
This week you will be designing the database for the Food Order App in MongoDb. You will create
collections, insert documents and retrieve records from the database.
All the create and insert operations in the database should be performed by executing the script.js file
given in Script_To_Populate_Database folder.
All the select operations should be performed using the Mongo Shell. You can also use the MONGOSH
shell attached to MongoDB Compass at the bottom
Problem Statement
Your task is as follows -
1. Create Database and Collections
Create a database named FoodOrderAppDb in your MongoDB Compass(using localhost
connection) or MongoDb Atlas cloud account.
Create users, userSessions, categories, cuisines, restaurants, food items, menus,
menuitems, carts, cartitems, shippingDetails, orders and orderitems collections.
Further, we need to insert data in the collections. We have already created a script using
mongoose library to create various schemas and models. Also, we have added code to
insert in these collections. For creating collections and inserting documents kindly follow
the steps given below:
1. Make sure that NodeJS is installed on the system.
2. Open the Script_To_Populate_Database folder in VSCode.
3. Open the terminal.
4. First run the command npm install to install node_modules and all the
dependencies.(for example, mongoose library)
5. Next, put your MongoDB Connection String in the mongoose.connect()
method.
6. Finally, run the command node script.js to create all the 13 collections and
insert documents in these collections from the json files present in the data
folder.
7. You can go to MongoDB Compass or MongoDB Atlas to see if the collections
are created with documents inserted in them.
8. Now you can take screenshots of documents entered in each collection and
paste in the respective placeholders provided in the NoSQL Assessment_For
Noncoders.docx file provided.
2. Retrieve records
Retrieve the following records -
i. All distinct category names
ii. All vegetarian fooditems
iii. Retrieve the name and address of each of the restaurants.
iv. All orders with orderTotalPrice within the range of $75 to $150.
v. All orders which were created after 10th May 2023.
vi. All fooditems belonging to Italian cuisine.
vii. Get the userName and email of the user with fullname "John Doe".
viii. Retrieve details of the order with the lowest orderTotalPrice.
ix. Get the count of menu items for fooditem Veg Pizza.
x. Get the count of orders for each restaurant

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

Students also viewed these Databases questions

Question

Explain how DSL works.

Answered: 1 week ago

Question

8. Explain the contact hypothesis.

Answered: 1 week ago

Question

7. Identify four antecedents that influence intercultural contact.

Answered: 1 week ago