PHP MongoDB驱动程序命令-Uncaught MongoDB\Driver\Exception\RuntimeException:Exception:未知的组运算符
我在php7中有以下php mongo代码,它失败了,出现以下错误php致命错误:Uncaught MongoDB\Driver\Exception\RuntimeException:Exception:unknown group operator'token'。我不确定是什么问题。堆栈跟踪将其放在executeCommand上。知道有什么问题吗PHP MongoDB驱动程序命令-Uncaught MongoDB\Driver\Exception\RuntimeException:Exception:未知的组运算符,php,mongodb,Php,Mongodb,我在php7中有以下php mongo代码,它失败了,出现以下错误php致命错误:Uncaught MongoDB\Driver\Exception\RuntimeException:Exception:unknown group operator'token'。我不确定是什么问题。堆栈跟踪将其放在executeCommand上。知道有什么问题吗 $mongoClient = new MongoDB\Driver\Manager('mongodb://'.$mongo_server_addres
$mongoClient = new MongoDB\Driver\Manager('mongodb://'.$mongo_server_address, $mongo_options);
$cmd = new MongoDB\Driver\Command(
[
'aggregate' => 'mycollection',
'pipeline' => [
['$group' => [
'key' => ["token" => 1],
'reduce' => new \MongoDB\BSON\Javascript("function( curr, result ) { result.count++; }"),
'cond' => [
'token' => ['$ne' => NULL],
'token' => ['$exists' => true, '$not' => ['$size' => 0]],
'createdAt' => ['$gte' => new MongoDB\BSON\UTCDateTime(strtotime(date('Y-m-d', strtotime('-1 days')) . ' 00:00:00')), '$lte' => new MongoDB\BSON\UTCDateTime(strtotime(date('Y-m-d') . ' 00:00:00'))]
],
'initial' => ["count" => 0]
]]
],
'cursor' => new stdClass()
]
);
$rows = $mongoClient->executeCommand($mongo_table_name, $cmd);
可能是重复的不是重复的。这是node.js,我的问题是phpposible duplicate,它不是duplicate。这是node.js,我的问题是关于php的