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

Laboratory Exercise CRUD Operation

1. Create a database named MongoLab1 and insert documents into the employees collection. 2. Remove the "ReportingTo" field where its value is null from the employees collection. 3. Update all documents by increasing their salary by 5000 using the $inc operator. 4. Update the documents of "Reg Rubio" and "Ian Tayao" to add "President" to their Reporting field.

Uploaded by

Saka Tubo
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)
656 views

Laboratory Exercise CRUD Operation

1. Create a database named MongoLab1 and insert documents into the employees collection. 2. Remove the "ReportingTo" field where its value is null from the employees collection. 3. Update all documents by increasing their salary by 5000 using the $inc operator. 4. Update the documents of "Reg Rubio" and "Ian Tayao" to add "President" to their Reporting field.

Uploaded by

Saka Tubo
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/ 3

1.

Using Mongo shell, create a database named MongoLab1 and insert the documents below into the
employees collection.

2. Remove all the “ReportingTo” field in employees collection where its value is null.

3. Using the $inc operator, update all the documents by increasing their salary by 5000.

4. Update the document of “Reg Rubio” and “Ian Tayao” by adding the “President” to their Reporting
field.
5. Find the document where their salary is above “21,000.00”.

6. Find the document where their name starts with “S” and “R”.

7. Find the document that is not reporting to the “President”

8. Update all the document by adding a sub-document named “contact” with a key-value, “email”:
[email protected]” (Example: [email protected]) and “phone”: “+1 1234567” (note: +1 value should
depend on their rank number).

You might also like