I'm using a geoNear()
to calculate distances between objects in my Mongo database.
The query works perfectly, even with addition field filters such as ->field('name')->equals($name)
etc...
This automatically populates a mapped field @ODM\Distance on the object.
$this->getQueryBuilder()
->geoNear((float) $query['near_longitude'], (float) $query['near_latitude'])
->spherical(true)
->distanceMultiplier(self::EARTH_RD_KM);
If I add an ->field('id')->in($array)
however this distance is suddenly 0.
I'm not really sure where the information is lost.
Is this a limitation on how $in works on MongoDB?