note 108315 added to mongocollection.ensureindex
| From: | coffee dot stone at gmail dot com | Date: | Tue, 17 Apr 2012 08:05:00 +0000 |
| Subject: | note 108315 added to mongocollection.ensureindex | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-187196@lists.php.net to get a copy of this message | ||
be careful when using ensureIndex('loc'=>'2d')
for example, if the data structure of loc is array('lng'=>120,
'lat'=>-30), when it is saved into database, its structure will be
['lat':-30, 'lng':120], it is because the array in PHP is the ordered map, not
the order of literal in your code. so the 2d-index is mapped as (lat, lng). when you find your
location with (lng, lat), the wrong results are returned.
be careful
----
Server IP: 69.147.83.197
Probable Submitter: 58.41.48.249
----
Manual Page -- http://www.php.net/manual/en/mongocollection.ensureindex.php
Edit -- https://master.php.net/note/edit/108315
Del: integrated -- https://master.php.net/note/delete/108315/integrated
Del: useless -- https://master.php.net/note/delete/108315/useless
Del: bad code -- https://master.php.net/note/delete/108315/bad+code
Del: spam -- https://master.php.net/note/delete/108315/spam
Del: non-english -- https://master.php.net/note/delete/108315/non-english
Del: in docs -- https://master.php.net/note/delete/108315/in+docs
Del: other reasons-- https://master.php.net/note/delete/108315
Reject -- https://master.php.net/note/reject/108315
Search -- https://master.php.net/manage/user-notes.php