Files Links: https://drive.google.com/drive/folders/10CssG86ruVkS1bwe-B7VIpwBx2twS6n-?usp=share_link https://drive.google.com/drive/folders/10CssG86ruVkS1bwe-B7VIpwBx2twS6n-?usp=share_link You will use products.json dataset. Download products.json from Blackboard and store it in a folder named dataset. Run the mongodb server:
Files Links:
https://drive.google.com/drive/folders/10CssG86ruVkS1bwe-B7VIpwBx2twS6n-?usp=share_link
https://drive.google.com/drive/folders/10CssG86ruVkS1bwe-B7VIpwBx2twS6n-?usp=share_link
You will use products.json dataset. Download products.json from Blackboard and store it in a folder named dataset. Run the mongodb server:
> mongod
When MongoDB starts successfully, open another Windows command prompt andexecutemongosh
> mongosh
In this lab we import data from the products.json file. To import data in MongoDB
You should see the databaseinventoryadded to the list of your databases. To see the documents inside the database:
- use inventory
db.products.find().forEach(printjson)
Please include bothqueriesand theresultin the answer box.
See the following example:
Query:db.products.find({"color":"black"})
Result: [ { _id: ObjectId("507d95d5719dbef170f15bfc"), name: 'AC3 Case Black', type: [ 'accessory', 'case' ], color: 'black', price: 12.5, rating: 2, warranty_years: 0.25, available: false, for: 'ac3' } ]
QUESTION 1
Writte a query to return name and price of each product in the inventory database.
QUESTION 2
Writte a query to return name and price for products of type accessory in the inventory database
QUESTION 3
Writte a query to return name and price for products with price between $12 and $20 (Values 12 and 20 are included).
QUESTION 4
Writte a query to return id, name, price, and type for products that are not of type accessory.
QUESTION 5
Writte a query to return id, name, price, and type for products with type accessory or service.
QUESTION 6
Writte a query to return id, name, price, and type for products that do have the type key.
QUESTION 7
Writte a query to return id, name, price, and type for products that their type is both accessory and case.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Below are the MongoDB queries and their corresponding results based on the given instructions Query ...See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started