Mongodb Classroom image

Anil  Bist / Professional / DataBase

To post your Question Join Classroom
Lesson Topics's No:-  ||
Lessons:-More update operators

More update operator

You can use other operators besides You can use other operators besides  $set  when updating a document. The  $push  operator allows you to push a
value into an array, in this case we will add a new nickname to the  nicknames  array. when updating a document.

db. people.update ( { name: 'Tom' }, { $push: { nicknames: 'Tommy' } } )
//  This adds the string  'Tommy'  into the nicknames array in Tom's document.


The $pull  operator is the opposite of $push, you can pull specific items from arrays. 

db. people.update ( { name: 'Tom' }, { $pull: { nicknames:  'Tommy' } } )
//  This removes the string 'Tommy' from the nicknames array in Tom's document.


The  $pop  operator allows you to remove the first or the last value from an array. Let's say Tom's document has a property called siblings that has the value  [ 'Marie''Bob' 'Kevin' 'Alex' ]. 


Anil  Bist

Skills    Mongodb

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,India

in 2006, i Join a web development company in Bangalore and start work on "Ruby on Rail" this is my first web development framework and we worked in this framework and develop four to five project after some time , I moved to JEE/Sturst frame work,

After some time i decided that now times come and I have to go on in my own way and I started a company name is "Soarlogic&q


  Students (0)