Professional Documents
Culture Documents
db.createCollection(“employees”)
db.employees.insertMany([
{id: 1, Name: "Steve Badiola", Salary: 16099.55, Position: "President", Rank: 1, ReportingTo: null},
{id: 2, Name: "Jamir Garcia", Salary: 14567.12, Position: "Vice-President", Rank: 2, ReportingTo:
['President']},
{id: 3, Name: "Reg Rubio", Salary: 13891.22, Position: "Secretary", Rank: 3, ReportingTo: ['Vice-
President']},
{id: 4, Name: "Ian Tayao", Salary: 13000, Position: "Treasurer", Rank: 4, ReportingTo: ['Secretary', 'Vice-
President']}
]);
db.employees.deleteOne(
{ReportingTo: null}
)
db.employees.updateOne(
{$set:{ReportingTo:[‘President’]}}
)
db.employees.updateOne(
{$set:{ReportingTo:[‘President’]}}
)
db.employees.findOne(
{Salary:{$gt: 21000.00}}
)
Db.employees.findOne(
{ReportingTo:{$not:{$in: [‘President’]}}}