简体   繁体   English

PHP中的find()查询无法正常工作-Mongodb

[英]find() query in php not working- Mongodb

I am trying to implement find() query in php. 我正在尝试在php中实现find()查询。 I have the following geoJSON : 我有以下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" . 从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. 一旦从查询结果中获得了光标,就必须像foreach一样在光标($ cursor)中循环。 Let mw know if you're able to solve the problem. 让mw知道您是否能够解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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