Skip to content

Commit 126e103

Browse files
authored
Merge pull request #1910 from alcaeus/drop-index-options
Separate index creation options from index options
2 parents 8c0c5da + 9e05a40 commit 126e103

File tree

17 files changed

+376
-254
lines changed

17 files changed

+376
-254
lines changed

UPGRADE-2.0.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929

3030
* The `--depth` option in the `odm:query` command was dropped without
3131
replacement.
32+
* The `--timeout` option for all schema commands was dropped. You should use the
33+
`--maxTimeMs` option instead.
3234

3335
## Aggregation builder
3436
* The `debug` method in `Doctrine\ODM\MongoDB\Aggregation\Stage\Match` was dropped
@@ -111,6 +113,8 @@ are no longer possible:
111113
`dbRefWithDB`. This omits the `$db` key in the `DBRef` object when possible.
112114
This only has implications if you consume documents outside of ODM and require
113115
the `$db` key to be set or if you are using multiple databases to store data.
116+
* The `dropDups` option on indexes has been dropped without replacement since it
117+
is no longer respected by MongoDB.
114118

115119
### YAML mapping
116120

docs/en/reference/indexes.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ You can customize the index with some additional options:
4040
**name** - The name of the index. This can be useful if you are
4141
indexing many keys and Mongo complains about the index name being
4242
too long.
43-
-
44-
**dropDups** - If a unique index is being created and duplicate
45-
values exist, drop all but one duplicate value.
4643
-
4744
**background** - Create indexes in the background while other
4845
operations are taking place. By default, index creation happens

docs/en/reference/xml-mapping.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ of several common elements:
114114
<field field-name="email" type="string" unique="true" order="desc" />
115115
<field field-name="createdAt" type="date" />
116116
<indexes>
117-
<index unique="true" dropDups="true">
117+
<index unique="true">
118118
<key name="username" order="desc" />
119119
<option name="safe" value="true" />
120120
</index>

lib/Doctrine/ODM/MongoDB/Mapping/Annotations/AbstractIndex.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ abstract class AbstractIndex extends Annotation
1414
/** @var string */
1515
public $name;
1616

17-
/** @var bool|null */
18-
public $dropDups;
19-
2017
/** @var bool|null */
2118
public $background;
2219

lib/Doctrine/ODM/MongoDB/Mapping/Driver/AnnotationDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ private function addIndex(ClassMetadata $class, AbstractIndex $index, array $key
237237
{
238238
$keys = array_merge($keys, $index->keys);
239239
$options = [];
240-
$allowed = ['name', 'dropDups', 'background', 'unique', 'sparse', 'expireAfterSeconds'];
240+
$allowed = ['name', 'background', 'unique', 'sparse', 'expireAfterSeconds'];
241241
foreach ($allowed as $name) {
242242
if (! isset($index->$name)) {
243243
continue;

lib/Doctrine/ODM/MongoDB/Mapping/Driver/XmlDriver.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,6 @@ private function addFieldMapping(ClassMetadata $class, array $mapping) : void
286286
if (isset($mapping['background'])) {
287287
$options['background'] = (bool) $mapping['background'];
288288
}
289-
if (isset($mapping['drop-dups'])) {
290-
$options['dropDups'] = (bool) $mapping['drop-dups'];
291-
}
292289
if (isset($mapping['index-name'])) {
293290
$options['name'] = (string) $mapping['index-name'];
294291
}
@@ -424,9 +421,6 @@ private function addIndex(ClassMetadata $class, SimpleXMLElement $xmlIndex) : vo
424421
if (isset($attributes['background'])) {
425422
$options['background'] = ((string) $attributes['background'] === 'true');
426423
}
427-
if (isset($attributes['drop-dups'])) {
428-
$options['dropDups'] = ((string) $attributes['drop-dups'] === 'true');
429-
}
430424
if (isset($attributes['name'])) {
431425
$options['name'] = (string) $attributes['name'];
432426
}

0 commit comments

Comments
 (0)