We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Problems with Phalcon\Mvc\Collection::aggregate in 2.0.0

Hello,

I am trying to upgrade a 1.3.x project to 2.0.0 and I have resolved every issue so far except for this one.

I am running a $geoNear query through the aggregation pipeline and this used to work perfectly in the previous version, though now I am getting the following error:

exception: geoNear command failed: { ok: 0.0, errmsg: "can't find ns" }

Not sure what has changed or what to do to fix this problem.

Here's my query:

    $query = [
      [
        '$geoNear' => [
          'near' => [
            'type' => 'Point',
            'coordinates' => [(float) $longitude, (float) $latitude]
          ],
          'distanceField' => 'dist.calculated',
          'maxDistance' => $distanceInMeters,
          'query' => [
            'partner_id' => intval($partner_id),
            'active' => true
          ],
          'includeLocs' => 'dist.location',
          'num' => 500,
          'spherical' => true
        ]
      ],
      [
        '$sort' => [ 'dist.calculated' => 1 ]
      ]
    ];

Does anybody have a clue as to what's going wrong here? Should I report an issue as well?

Could you please report this as an issue on Github?