Aysennoussi
Aysennoussi

Reputation: 3860

Doctrine query findBy returns Doctrine\ODM\MongoDB\LoggableCursor object

I don't know what's the problem but when I run this code

$reposit = $this->get('doctrine_mongodb')
                            ->getManager()
                            ->getRepository('ngNearBundle:Markers');                        
            $l=$reposit->findBy(array('lat'=>'35.691048'));

it returns a Doctrine\ODM\MongoDB\LoggableCursor object and not the mongodb document ! what should the problem be ?

Upvotes: 2

Views: 1331

Answers (1)

Paul Andrieux
Paul Andrieux

Reputation: 1847

The findBy() method return a collection of all matching results. If you want to get only one result, use findOneBy() method.

Upvotes: 1

Related Questions