1 | <?php |
||
26 | class MongoIndex |
||
27 | { |
||
28 | /** |
||
29 | * @var array<string,mixed> |
||
30 | */ |
||
31 | private $values; |
||
32 | |||
33 | private const BOOL_FIELDS = ['background', 'unique', 'sparse']; |
||
34 | private const FLOAT_FIELDS = ['min', 'max', 'bucketSize']; |
||
35 | private const INT_FIELDS = ['bits', '2dsphereIndexVersion', 'textIndexVersion', 'expireAfterSeconds']; |
||
36 | private const STRING_FIELDS = ['default_language', 'language_override']; |
||
37 | private const DOCUMENT_FIELDS = ['partialFilterExpression', 'storageEngine', 'weights']; |
||
38 | |||
39 | /** |
||
40 | * Creates an immutable MongoDB Index creation definition |
||
41 | * |
||
42 | * @param $keys - The key definition |
||
43 | * @param $name - Optional. The index name. |
||
44 | * @param $options - Optional. Any index creation options. |
||
45 | * @see https://docs.mongodb.com/manual/reference/command/createIndexes/ |
||
46 | */ |
||
47 | public function __construct(iterable $keys, string $name = null, ?iterable $options = null) |
||
87 | |||
88 | /** |
||
89 | * Gets the array version of this index. |
||
90 | * |
||
91 | * @return array<string,mixed> The array version |
||
92 | */ |
||
93 | public function toArray(): array |
||
97 | } |
||
98 |