MongoDB Exercise
MongoDB Exercise
MongoDB Exercise
Instruction: Please go through the queries first and you would know how many documents to
create with what key value pairs.
2. How will you display only two fields apart from the id?
3. How will you display all the fields and not the id?
4. How will you display the sales which happened in the stores in Delhi.
Hint: Find().limit(5)
6. How will you display the next 5 sales after skipping first 5 which happened in Delhi
Hint: Find().skip(5).limit(5)
7. How will you list all those sales agents who achieved a score more than 90.
8. How will you find the outlets which are located in Jaipur.
9. How will you identify the stores that do not sell merchandise and the user rating is more than
70.
10. 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.
11. How will you find the stores which contain ‘A’ as the last letter for the name of city.
12. Write a MongoDB query to know whether all the addresses contain the pin code or not.
13. How will you write a query which will select those stores which returns 0 as a remainder
after dividing the score by 6.