Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 1.0.0BETA2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      "Near" statement does not work for me. The following code returns all cities from collection:

      $cities = $this->dm->createQuery('City')
          ->field('coordinates')->near(50, 60)
          ->execute();
      

      Could you please fix it?

        Activity

        Dmitry created issue -
        Hide
        mark wright added a comment -

        It also does not work in beta3 but it fails differently. It never returns anything.

        $places = $documentManager->createQueryBuilder('Documents\Place')
        ->field('point')
        ->near(36.5788494, -121.7207804)
        ->getQuery()
        ->execute();

        This returns 0 documents even though I have a point at 36.5788493, -121.7207805. Doctrine\MongoDB\Query\Builder::near() only takes one argument so the Y value is ignored. However, the docblock specifies 2 params.

        Show
        mark wright added a comment - It also does not work in beta3 but it fails differently. It never returns anything. $places = $documentManager->createQueryBuilder('Documents\Place') ->field('point') ->near(36.5788494, -121.7207804) ->getQuery() ->execute(); This returns 0 documents even though I have a point at 36.5788493, -121.7207805. Doctrine\MongoDB\Query\Builder::near() only takes one argument so the Y value is ignored. However, the docblock specifies 2 params.
        Hide
        Tim Sakharchuk added a comment - - edited

        Hi All,

        Here is correct realization of this function in
        Doctrine\MongoDB\Query\Builder

        public function near($x, $y)

        { $this->query['type'] = Query::TYPE_GEO_LOCATION; $this->query['near'] = array($x, $y); return $this; }

        When may this fix appear in Doctrine ODM?

        Thanks!

        Show
        Tim Sakharchuk added a comment - - edited Hi All, Here is correct realization of this function in Doctrine\MongoDB\Query\Builder public function near($x, $y) { $this->query['type'] = Query::TYPE_GEO_LOCATION; $this->query['near'] = array($x, $y); return $this; } When may this fix appear in Doctrine ODM? Thanks!
        Hide
        Shane A. Stillwell added a comment -

        I had the same issue on 1.0.0.BETA3.

        The solution was to change the query up a little.

        $places = $this->dm->createQueryBuilder('\Application\Event')->field('latitude')->near(50)->field('longitude')->near(60)->getQuery()->execute(); 
        

        http://stackoverflow.com/a/9015906/179335

        Show
        Shane A. Stillwell added a comment - I had the same issue on 1.0.0.BETA3. The solution was to change the query up a little. $places = $this->dm->createQueryBuilder('\Application\Event')->field('latitude')->near(50)->field('longitude')->near(60)->getQuery()->execute(); http://stackoverflow.com/a/9015906/179335

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=MODM-153, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Dmitry
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: