title: how to update in element array mongodb
body: <p>I have a exemple data: </p>
  
  <pre><code>"_id" : ObjectId("5694ba11b3957b7ff69c4547"),
  "name" : "Okas 1",
  "job" : {
      "name" : "job try1",
      "_id" : ObjectId("5a6ff9f7a336e3bba40a1d5c")
  },
  "categories" : {
      "ss" : [ 
          {
              "name" : "10",
              "_id" : ObjectId("5a6ff9f7a336e3bba40a1d5c")
          }, 
          {
              "name" : "50",
              "_id" : ObjectId("5a6ff9f7a336e3bba40a1d5f")
          }
      ]
  }
  </code></pre>
  
  <p>if I update with new data . </p>
  
  <pre><code>[{
     "name" : "800",
     "_id" : ObjectId("5a6ff9f7a336e3bba40a1d5a")
  },
  {
     "name" : "8",
     "_id" : ObjectId("5a6ff9f7a336e3bba40a1d5f")
  }]
  </code></pre>
  
  <p>I should get the data</p>
  
  <pre><code>"_id" : ObjectId("5694ba11b3957b7ff69c4547"),
  "name" : "Okas 1",
  "job" : {
      "name" : "job try1",
      "_id" : ObjectId("5a6ff9f7a336e3bba40a1d5c")
  },
  "categories" : {
      "ss" : [ 
          {
              "name" : "10",
              "_id" : ObjectId("5a6ff9f7a336e3bba40a1d5c")
          }, 
          {
              "name" : "8",
              "_id" : ObjectId("5a6ff9f7a336e3bba40a1d5f")
          },    
          {
               "name" : "800",
               "_id" : ObjectId("5a6ff9f7a336e3bba40a1d5a")
          }
      ]
  }
  </code></pre>
  
  <blockquote>
    <p>So I want to update if data exeist just update value but if not exist
    add new element in to array categories. I try but not working.  the
    results are not appropriate</p>
  </blockquote>