Fixed some questions to match the queries.

This commit is contained in:
K 2024-10-17 20:27:09 +05:30
parent 37fc21421d
commit e0d47201ee
Signed by: notkshitij
GPG Key ID: C5B8BC7530F8F43F
2 changed files with 3 additions and 3 deletions

View File

@ -152,7 +152,7 @@ db.Employee.insertMany([
db.Employee.find({ Designation: "Programmer", Salary: { $gt: 30000 } }) db.Employee.find({ Designation: "Programmer", Salary: { $gt: 30000 } })
``` ```
2. Create a new document if no document contains `{Designation: "Tester", Company_name: "TCS", Age: 25}`: 2. Create a new document if no document contains `{Designation: "Tester", Company_name: "Y-Space", Age: 25}`:
```mongodb ```mongodb
db.Employee.update( db.Employee.update(
{ Designation: "Tester", Company_name: "Y-Space", Age: 25 }, { Designation: "Tester", Company_name: "Y-Space", Age: 25 },
@ -174,7 +174,7 @@ db.Employee.find({ Address: { $elemMatch: { city: "Pune", Pin_code: "411001" } }
``` ```
5. Find all documents with Company_name "TCS" and modify their salary by 2000: 5. Find all documents with Company_name "Oscorp" and modify their salary by 2000:
```mongodb ```mongodb
db.Employee.updateMany( db.Employee.updateMany(
{ Company_name: "Oscorp" }, { Company_name: "Oscorp" },
@ -189,7 +189,7 @@ db.Employee.find({ Designation: { $ne: "Developer" } })
``` ```
7. Find _id, Designation, Address, and Name where Company_name is "Infosys": 7. Find _id, Designation, Address, and Name where Company_name is "Wayne Industries":
```mongodb ```mongodb
db.Employee.find( db.Employee.find(
{ Company_name: "Wayne Industries" }, { Company_name: "Wayne Industries" },