/** modify one row **/
 public function doModifyRow()
 {
     $this->db = xn("db");
     $this->collection = xn("collection");
     $id = rock_real_id(xn("id"));
     //selected format last time
     $this->last_format = rock_cookie("rock_format", "json");
     import("lib.mongo.RQuery");
     $query = new RQuery($this->_mongo, $this->db, $this->collection);
     $this->row = $query->id($id)->findOne();
     if (empty($this->row)) {
         $this->error = "Record is not found.";
         $this->display();
         return;
     }
     $this->data = $this->row;
     unset($this->data["_id"]);
     import("classes.VarExportor");
     $export = new VarExportor($query->db(), $this->data);
     $this->data = $export->export($this->last_format);
     if ($this->last_format == "json") {
         $this->data = json_unicode_to_utf8($this->data);
     }
     if ($this->isPost()) {
         $this->data = xn("data");
         $format = x("format");
         $this->last_format = $format;
         $row = null;
         $eval = new VarEval($this->data, $format, $this->_mongo->selectDb($this->db));
         $row = $eval->execute();
         if ($row === false || !is_array($row)) {
             $this->error = "Only valid {$format} is accepted.";
             $this->display();
             return;
         }
         $query = new RQuery($this->_mongo, $this->db, $this->collection);
         $obj = $query->id($this->row["_id"])->find();
         $oldAttrs = $obj->attrs();
         $obj->setAttrs($row);
         foreach ($oldAttrs as $oldAttr => $oldValue) {
             if ($oldAttr == "_id") {
                 continue;
             }
             if (!array_key_exists($oldAttr, $row)) {
                 $obj->remove($oldAttr);
             }
         }
         try {
             $obj->save();
         } catch (Exception $e) {
             $this->error = $e->getMessage();
             $this->display();
             return;
         }
         //remember format choice
         $this->_rememberFormat($format);
         $this->message = "Updated successfully.";
     }
     $this->display();
 }