MongoDB Exercise
MongoDB Exercise
),
product (type, name etc.), quantity, region, items, amount, price, sales, customer age etc. with
arrays and other data types wherever applicable. Please go through the queries first and you
would know how many documents to create with what key value pairs.
2. Write a MongoDB query to display the fields; products and price for all the documents in the
collection.
3. Write a MongoDB query to display all the fields but exclude the field _id for all the
documents in the collection.
4. Write a MongoDB query to display the fields product and quantity, but exclude the field _id
for all the documents in the collection.
5. Write a MongoDB query to display all the sales that happened in Delhi.
7.Write a MongoDB query to display the next 5 sales after skipping first 5 which happened in
Delhi
8. Write a MongoDB query to find the sales agents who achieved a score more than 90.
9. Write a MongoDB query to find the sales agents that achieved a score, more than 80 but less
than 100.
10. Write a MongoDB query to find the outlets which are located in Jaipur.
11. Write a MongoDB query to find the stores that do not sell merchandise and the user rating is
more than 70.
14. Write a MongoDB query to find the store Id, name, and total sales for those stores which
contain A' as first letter for the name of city.
15. Write a MongoDB query to find the store Id, name, and total sales for those stores which
contain I as the last letter for the name of city.
16. Write a MongoDB query to know whether all the addresses contain the pin code or not.
17. Write a MongoDB query which will select the Store Id, name and customer rating score for
those stores which returns 0 as a remainder after dividing the score by 5.