@@ 1249-1262 (lines=14) @@ | ||
1246 | * @param string $field |
|
1247 | * @return \Sokil\Mongo\Collection |
|
1248 | */ |
|
1249 | public function ensure2dSphereIndex($field) |
|
1250 | { |
|
1251 | if (is_array($field)) { |
|
1252 | $keys = array_fill_keys($field, '2dsphere'); |
|
1253 | } else { |
|
1254 | $keys = array( |
|
1255 | $field => '2dsphere', |
|
1256 | ); |
|
1257 | } |
|
1258 | ||
1259 | $this->getMongoCollection()->createIndex($keys); |
|
1260 | ||
1261 | return $this; |
|
1262 | } |
|
1263 | ||
1264 | /** |
|
1265 | * Create geo index 2dsphere |
|
@@ 1272-1285 (lines=14) @@ | ||
1269 | * @param string $field |
|
1270 | * @return \Sokil\Mongo\Collection |
|
1271 | */ |
|
1272 | public function ensure2dIndex($field) |
|
1273 | { |
|
1274 | if (is_array($field)) { |
|
1275 | $keys = array_fill_keys($field, '2d'); |
|
1276 | } else { |
|
1277 | $keys = array( |
|
1278 | $field => '2d', |
|
1279 | ); |
|
1280 | } |
|
1281 | ||
1282 | $this->getMongoCollection()->createIndex($keys); |
|
1283 | ||
1284 | return $this; |
|
1285 | } |
|
1286 | ||
1287 | /** |
|
1288 | * Create fulltext index |