MongoDB Update

From mi-linux
Revision as of 22:31, 18 October 2016 by Cm1958 (talk | contribs) (Created page with "Main Page >> MongoDB >>MongoDB Workbook >> Updating Collections == Updating a Collection == To add an employee to department 40: db.de...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Main Page >> MongoDB >>MongoDB Workbook >> Updating Collections

Updating a Collection

To add an employee to department 40:

db.deptCollection.update({'deptno':40}, 
 {$set: 
   {'employees': [   
     {
      empno: 8888,
      ename: 'MARY',
      job: 'LECTURER',
      mgr: 7566,
      hiredate: new Date(),
      sal: 4000
     } 
   ]}
 }
)