简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM