在 parse-platform 中与 $gte 和 $lte 的聚合与 parse-sdk-php 不工作

Aggregation with $gte and $lte in Parse-platform with parse-sdk-php not working

我正在尝试 运行 使用 Parse-sdk-php 的聚合进行范围查询 ($gte) 和 ($lte),它正在返回我空

用例

我有一个包含 createdAt 键的 referrers 集合,当使用解析 greaterThanOrEqualTo()lessThanOrEqualTo() 方法搜索时,它返回结果,但是当 querying using the aggregation, 它 returns 一个 empty array.

管道

$query = new ParseQuery('referrers);

// $dateStart is an DateTime object
// $dateEnd is an DateTime  objectThis text will be hidden

$pipeline = [
    'match' => [
     'referrer' => ['$exists' => true],
     'createdAt' => [
         '$gte' => ParseClient::_encode($dateEnd, true),
         '$lte' => ParseClient::_encode($dateStart, true)
    ]               
];

$query->aggregate($pipeline);

带解码的查询字符串url

    {
       "referrer": {$exists: true}, 
       "createdAt":{
          "$gte": {__type: "Date", iso: "2020-01-01T17:15:40.000Z"},
          "$lte": {__type: "Date", iso: "2020-12-31T17:15:40.000Z"}
       }
    }
    {
        "referrer": {$exists: true}, 
        "createdAt":{
            "$gte": {__type: "Date", iso: "2020-01-01T17:15:40.000Z"},
            "$lte": {__type: "Date", iso: "2020-12-31T17:15:40.000Z"}
        }
    }

设置

    OS: WIN 10 20.04

    php -v:
    PHP 7.4.9

    parse php sdk version:
    "parse/php-sdk" : "1.6.*",

以下代码应该有效:

'match' => [
       'referrer' => [
              '$exists' => true
       ],
       'createdAt' => [
               '$lte' => ParseClient::_encode($dateEnd, true)['iso'],
               '$gte' => ParseClient::_encode($dateStart, true)['iso']
       ] 
]