Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP MongoDB驱动程序命令-Uncaught MongoDB\Driver\Exception\RuntimeException:Exception:未知的组运算符_Php_Mongodb - Fatal编程技术网

PHP MongoDB驱动程序命令-Uncaught MongoDB\Driver\Exception\RuntimeException:Exception:未知的组运算符

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

我在php7中有以下php mongo代码,它失败了,出现以下错误php致命错误:Uncaught MongoDB\Driver\Exception\RuntimeException:Exception:unknown group operator'token'。我不确定是什么问题。堆栈跟踪将其放在executeCommand上。知道有什么问题吗

$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的