user3691240
user3691240

Reputation: 121

find() query in php not working- Mongodb

I am trying to implement find() query in php. I have the following geoJSON :

{
                "_id": {
                    "$oid": "dfgdg35g4334fwvwe34f"
                },
                "type": "Feature",
                "geometry": {
                    "type": "Point",
                    "coordinates": [
                        12.12345678910111,
                        3.12345678910111
                    ]
                },
                "properties": {
                    "name": "Any Name"
                }
}

and querying as

$cursor = $collection->find(array("geometry"=> array("type"=>"Point")));

to get the results from geometry->type="Point" . What am i doing wrong cant seem to figure out the problem.

Upvotes: 1

Views: 110

Answers (1)

Carlos Garcell
Carlos Garcell

Reputation: 26

Once you get the cursor from the result of the query, you have to loop through the cursor ($cursor) in something like a foreach. Let mw know if you're able to solve the problem.

Upvotes: 1

Related Questions