|
|
@@ -508,7 +508,7 @@ class MongoCollection
|
|
|
if (is_string($keys)) {
|
|
|
$indexName = $keys;
|
|
|
} elseif (is_array($keys)) {
|
|
|
- $indexName = self::toIndexString($keys);
|
|
|
+ $indexName = \MongoDB\generate_index_name($keys);
|
|
|
} else {
|
|
|
throw new \InvalidArgumentException();
|
|
|
}
|
|
|
@@ -629,20 +629,6 @@ class MongoCollection
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @param mixed $keys
|
|
|
- * @static
|
|
|
- * @return string
|
|
|
- */
|
|
|
- protected static function toIndexString($keys)
|
|
|
- {
|
|
|
- $result = '';
|
|
|
- foreach ($keys as $name => $direction) {
|
|
|
- $result .= sprintf('%s_%d', $name, $direction);
|
|
|
- }
|
|
|
- return $result;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* Performs an operation similar to SQL's GROUP BY command
|
|
|
*
|
|
|
* @link http://www.php.net/manual/en/mongocollection.group.php
|