title: mongodb insert a new field into an array
body: <p>I am trying to insert a new field to an array of objects</p>
  
  <pre><code>{
      "_id": "543356fe0c9af6066e68970c",
      "createdDate": "2014-10-06 07:59 pm",
      "cancle": false,
      "eventDate": "2014/12/12",
      "eventstatus": true,
      "location": "chennai",
      "userId": "54310801e2659ecc3650100b",
      "createdBy": "one",
      "eventName": "tea ",
      "__v": 0,
      "friends": [
          {
              "userId": "54310814e2659ecc3650100c",
              "userName": "two",
              "phoneNumber": "22222222"
          },
          {
              "userId": "54310945e2659ecc3650100d",
              "userName": "three",
              "phoneNumber": "33333333"
          },
          {
              "userId": "54334def7e85de48638d1069",
              "userName": "four",
              "phoneNumber": "44444444"
          }
      ]
  }
  </code></pre>
  
  <p>I want to add "status" : 0 to all the objects inside friends array</p>
  
  <p>I tried using addtoset, push and multiple ways, its adding as a new object in friends array. </p>
  
  <pre><code>db.events.update({},{$push:{ "friends" : {"status" : 0} }},false,true)
  db.events.update({},{$addToSet : {'friends' : $each: [{ 'status':0}]}},false,true)
  </code></pre>
  
  <p>Please let me know what i am doing wrong. 
  Thanks for your help</p>