note 108315 deleted from mongocollection.ensureindex by derick

From: Date: Thu, 29 Nov 2012 13:01:08 +0000
Subject: note 108315 deleted from mongocollection.ensureindex by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-192194@lists.php.net to get a copy of this message
Note Submitter: coffee dot stone at gmail dot com ---- 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

« previous php.notes (#192194) next »