title: mongodb error in using php
body: <p>i can try to update the attempt to login in mongodb but it can showing error
  in php with my sql i can use this code:</p>
  
  <pre><code>$columns = "";
    foreach($toUpdate as $k =&gt; $v){
      $columns .= "$k = :$k, ";
    }
    $columns = substr($columns, 0, -2); // Remove last ","
  
    $sql = $this-&gt;dbh-&gt;prepare("UPDATE user  SET {$columns} WHERE id=:id");
    $sql-&gt;bindValue(":id", $user);
    foreach($toUpdate as $key =&gt; $value){
      $value = htmlspecialchars($value);
      $sql-&gt;bindValue(":$key", $value);
    }
  
    $sql-&gt;execute();
  </code></pre>
  
  <p>in this code it can display no.of attempt to login..but can write this code in php with mongodb it can showing error</p>
  
  <pre><code>$columns = "";
    foreach($toUpdate as $k =&gt; $v){
      $columns .= "$k = :$k, ";
    }
    $columns = substr($columns, 0, -2); // Remove last ","
  
                          $collection=user;//table name;
                          $set = array('$set' =&gt;array(array($columns)));
                          $m-&gt;$collection-&gt;update(array(id=&gt;$user),$set);
  
    foreach($toUpdate as $key =&gt; $value)
    {
        var_dump($toUpdate);
      $value = htmlspecialchars($value);
      $m-&gt;$collection-&gt;update(array(id=&gt;$value),$set);
  
    }
  </code></pre>
  
  <p>i can try many way but it show error ....this is error</p>
  
  <blockquote>
    <p>Uncaught exception 'MongoWriteConcernException' with message
    'localhost:27017: Modifiers operate on fields but we found type array
    instead. For example: {$mod: {: ...}} not {$set: [ [ "attempt =
    :attempt" ] ]})</p>
  </blockquote>
  
  <p>any one can know how to solve this</p>