Beispiel #1
0
 /**
  * 返回INSERT,UPDATE 或 DELETE 查询所影响的记录行数
  *
  * @param \MongoDB\Driver\WriteResult $handle
  * @param int $type 执行的类型1:insert、2:update、3:delete
  *
  * @return int
  */
 public function affectedRows($handle, $type)
 {
     switch ($type) {
         case 1:
             return $handle->getInsertedCount();
             break;
         case 2:
             return $handle->getModifiedCount();
             break;
         case 3:
             return $handle->getDeletedCount();
             break;
         default:
             return false;
     }
 }