hxp
2025-06-04 f4a514d5ac952110da846636ecbb9de951eaf3d2
db/DBOper.php
@@ -286,7 +286,7 @@
      }
      $dbName = GetDBName();
      $ret = $conn->$dbName->$collectionName->remove($find);
      \Logging\LogInfo('Mongo Remove: $ret=' . $ret . ', find=' . print_r($find, true));
      \Logging\LogInfo('Mongo Remove:' . $collectionName . ' $ret=' . $ret . ', find=' . print_r($find, true));
      MongoDBPool::Close($conn);
      return true;
   }
@@ -302,7 +302,7 @@
      if (isset($ret) && $ret["ok"] == 1) {
         $retArray = $ret["result"];
      }
      \Logging\LogInfo('Mongo Aggregate: $ret=' . $ret);
      // \Logging\LogInfo('Mongo Aggregate: $ret=' . $ret);
      MongoDBPool::Close($conn);
      return true;
   }
@@ -357,6 +357,24 @@
   if ($useRedis) {
      if ($retArray) {
         \RedisOper\SetHashObj($redisKey, $retArray);
      }
   }
   return true;
}
function FindOneSort($collectionName, $find, &$retArray, $fields = null, $sortArray = null)
{
   $dbName = GetDBName();
   if (!$dbName) {
      return false;
   }
   if (!MongoDBOper::Find($collectionName, $find, $retFindArray, $fields, $sortArray, 1)) {
      return false;
   }
   if (isset($retFindArray)) {
      foreach ($retFindArray as $value) {
         $retArray = $value;
         break;
      }
   }
   return true;
@@ -486,4 +504,4 @@
   }
   return true;
}
}