0% found this document useful (0 votes)
271 views

NoSQL Assignment E19022

This document contains 20 questions about performing various operations on a MongoDB database and collection. It involves creating a database and collection, inserting documents, writing queries to retrieve, update and delete documents, and creating indexes. The operations include adding, finding, updating, and removing documents from the collection based on field values.

Uploaded by

chaimae naji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
271 views

NoSQL Assignment E19022

This document contains 20 questions about performing various operations on a MongoDB database and collection. It involves creating a database and collection, inserting documents, writing queries to retrieve, update and delete documents, and creating indexes. The operations include adding, finding, updating, and removing documents from the collection based on field values.

Uploaded by

chaimae naji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 26

NoSQL-Assignment

Q1. Create database praxis

Q2 Create collection restaurant

Q3. Insert below json in collection restaurant and then add at least 4 more in same
collection
Q4. Write a MongoDB query to display all the documents in the collection restaurant
Q5. Write a MongoDB query to display the fields restaurant_id, name, borough and cuisine
for all the documents in the collection restaurant.
Q6. Write a MongoDB query to display the fields restaurant_id, name, borough and cuisine,
but exclude the field “_id” for all the documents in the collection restaurant.

Q7. Write a MongoDB query to display the fields restaurant_id, name, borough, zip code
and grade, but exclude the field _id for all the documents in the collection restaurant.
Q8. Write a MongoDB query to display all the restaurant which is in the borough croydon.
Q9. Write a MongoDB query to display the first 5 restaurant which is in the borough Ealing.
Q10. Write a MongoDB query to display the next 1 restaurants after skipping first 2 which
are in the borough Eagling.
Q11. Write a MongoDB query to find the restaurants who achieved a score more than 9.
Q12. Write a MongoDB query to find the restaurants that achieved a score, more than 4 but
less than 10.
Q13. Write a MongoDB query to find the restaurants which do not prepare any cuisine of
'American ' and achieved a grade point 'A' not belongs to the borough croydon. The
document must be displayed according to the cuisine in descending order.
Q14. Update document zipcode of all documents to 560070

Q15.Update document zipcode to 987456 of document where borough is Croydon.

Record where borough is Croydon has been changed (zipcode as 987456)


Q16. Remove document where restaurant id is ‘12345’

No restaurant with id as 12345, hence no record removed.

Q17. Remove sub document grades from document where zipcode is 987456.

Q18. Create index on collection restaurant on column restaurant_id enforcing uniqueness

Q19. Create compound index on any 2 keys of collection restaurants.

Q20. Drop database praxis.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy