[MODM-153] "Near" Query does not work. Created: 10/Aug/11 Updated: 20/Feb/12 |
|
| Status: | Open |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0BETA2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Dmitry | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| 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? |
| Comments |
| Comment by mark wright [ 02/Sep/11 ] |
|
It also does not work in beta3 but it fails differently. It never returns anything. $places = $documentManager->createQueryBuilder('Documents\Place') 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. |
| Comment by Tim Sakharchuk [ 04/Sep/11 ] |
|
Hi All, Here is correct realization of this function in 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! |
| Comment by Shane A. Stillwell [ 20/Feb/12 ] |
|
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();
|