/** * Set the "minDistance" option for a geoNear command query or add * $minDistance criteria to the query. * * If the query is a geoNear command ({@link Expr::geoNear()} was called), * the "minDistance" command option will be set; otherwise, $minDistance * will be added to the current expression. * * If the query uses GeoJSON points, $minDistance will be interpreted in * meters. If legacy point coordinates are used, $minDistance will be * interpreted in radians. * * @see Expr::minDistance() * @see http://docs.mongodb.org/manual/reference/command/geoNear/ * @see http://docs.mongodb.org/manual/reference/operator/minDistance/ * @see http://docs.mongodb.org/manual/reference/operator/near/ * @see http://docs.mongodb.org/manual/reference/operator/nearSphere/ * @param float $minDistance * @return self */ public function minDistance($minDistance) { if ($this->query['type'] === Query::TYPE_GEO_NEAR) { $this->query['geoNear']['options']['minDistance'] = $minDistance; } else { $this->expr->minDistance($minDistance); } return $this; }
/** * Add $minDistance criteria to the query. * * If the query uses GeoJSON points, $minDistance will be interpreted in * meters. If legacy point coordinates are used, $minDistance will be * interpreted in radians. * * @see Expr::minDistance() * @see http://docs.mongodb.org/manual/reference/command/geoNear/ * @see http://docs.mongodb.org/manual/reference/operator/minDistance/ * @see http://docs.mongodb.org/manual/reference/operator/near/ * @see http://docs.mongodb.org/manual/reference/operator/nearSphere/ * @param float $minDistance * @return self */ public function minDistance($minDistance) { $this->query->minDistance($minDistance); return $this; }