我在各种环境中再次运行此查询:
$routes = array(); //assume is array of routes
$regex_1 = new MongoRegex("/(pattern1|pattern2|pattern3|pattern4)/");
$regex_2 = new MongoRegex("/(pattern1|pattern2|pattern3|pattern4|pattern5|pattern6)/");
foreach ($routes as $route) {
$where["name"] = $route["name"];
if (preg_match('/route1/', $routeName)) {
$where["url"] = array("\$not" => $regex_1);
} elseif (preg_match('/route2/', $routeName)) {
$where["url"] = array("\$not" => $regex_2);
}
$count = $col->count($where);
在我的本地环境中一切正常,但是,一旦我将代码放在QA服务器上,它就会失败而没有任何错误或日志。我已经研究了几天了,我不知道该怎么做了。我尝试以多种方式重构查询,没有任何效果。
我检查了php模块版本只是为了确定它们都是一样的。
我注意到的一件事是,当模式很短(少于5或6个匹配)时,查询在所有环境中运行正常。它似乎都有效。
所以我想问题是:这里有什么问题?这是代码吗?组态? php模块? mongo本身?...
希望这是有道理的。干杯!