Skip to content

Commit 985f4dc

Browse files
committed
PHPLIB-1512: Remove IndexInfo::isGeoHaystack() method
1 parent 8d91d6e commit 985f4dc

File tree

4 files changed

+1
-80
lines changed

4 files changed

+1
-80
lines changed

UPGRADE-2.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ UPGRADE FROM 1.x to 2.0
55
* The `MongoDB\ChangeStream::CURSOR_NOT_FOUND` constant is now private.
66
* The `MongoDB\Operation\Watch::FULL_DOCUMENT_DEFAULT` constant has been
77
removed.
8+
* The `MongoDB\Model\IndexInfo::isGeoHaystack` method has been removed.
89

910
GridFS
1011
------

src/Model/IndexInfo.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323

2424
use function array_key_exists;
2525
use function array_search;
26-
use function trigger_error;
27-
28-
use const E_USER_DEPRECATED;
2926

3027
/**
3128
* Index information model class.
@@ -120,19 +117,6 @@ public function is2dSphere()
120117
return array_search('2dsphere', $this->getKey(), true) !== false;
121118
}
122119

123-
/**
124-
* Return whether or not this index is of type geoHaystack.
125-
*
126-
* @return boolean
127-
* @deprecated Since 1.16: MongoDB 5.0 removes support for geoHaystack indexes.
128-
*/
129-
public function isGeoHaystack()
130-
{
131-
trigger_error('MongoDB 5.0 removes support for "geoHaystack" indexes, the method "IndexInfo::isGeoHaystack()" will be removed in a future release', E_USER_DEPRECATED);
132-
133-
return array_search('geoHaystack', $this->getKey(), true) !== false;
134-
}
135-
136120
/**
137121
* Return whether this is a sparse index.
138122
*

tests/Model/IndexInfoFunctionalTest.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,6 @@ public function testIs2dSphere(): void
3232
$this->assertEquals(3, $index['2dsphereIndexVersion']);
3333
}
3434

35-
/**
36-
* @group matrix-testing-exclude-server-5.0-driver-4.0
37-
* @group matrix-testing-exclude-server-5.0-driver-4.2
38-
* @group matrix-testing-exclude-server-5.0-driver-4.4
39-
*/
40-
public function testIsGeoHaystack(): void
41-
{
42-
$this->skipIfGeoHaystackIndexIsNotSupported();
43-
44-
$indexName = $this->collection->createIndex(['pos' => 'geoHaystack', 'x' => 1], ['bucketSize' => 5]);
45-
$result = $this->collection->listIndexes();
46-
47-
$result->rewind();
48-
$result->next();
49-
$index = $result->current();
50-
51-
$this->assertEquals($indexName, $index->getName());
52-
$this->assertDeprecated(function () use ($index): void {
53-
$this->assertTrue($index->isGeoHaystack());
54-
});
55-
$this->assertEquals(5, $index['bucketSize']);
56-
}
57-
5835
public function testIsText(): void
5936
{
6037
$indexName = $this->collection->createIndex(['x' => 'text']);

tests/Model/IndexInfoTest.php

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ public function testBasicIndex(): void
2222
$this->assertSame('x_1', $info->getName());
2323
$this->assertSame('foo.bar', $info->getNamespace());
2424
$this->assertFalse($info->is2dSphere());
25-
$this->assertDeprecated(function () use ($info): void {
26-
$this->assertFalse($info->isGeoHaystack());
27-
});
2825
$this->assertFalse($info->isSparse());
2926
$this->assertFalse($info->isText());
3027
$this->assertFalse($info->isTtl());
@@ -46,9 +43,6 @@ public function testSparseIndex(): void
4643
$this->assertSame('y_sparse', $info->getName());
4744
$this->assertSame('foo.bar', $info->getNamespace());
4845
$this->assertFalse($info->is2dSphere());
49-
$this->assertDeprecated(function () use ($info): void {
50-
$this->assertFalse($info->isGeoHaystack());
51-
});
5246
$this->assertTrue($info->isSparse());
5347
$this->assertFalse($info->isText());
5448
$this->assertFalse($info->isTtl());
@@ -70,9 +64,6 @@ public function testUniqueIndex(): void
7064
$this->assertSame('z_unique', $info->getName());
7165
$this->assertSame('foo.bar', $info->getNamespace());
7266
$this->assertFalse($info->is2dSphere());
73-
$this->assertDeprecated(function () use ($info): void {
74-
$this->assertFalse($info->isGeoHaystack());
75-
});
7667
$this->assertFalse($info->isSparse());
7768
$this->assertFalse($info->isText());
7869
$this->assertFalse($info->isTtl());
@@ -94,9 +85,6 @@ public function testTtlIndex(): void
9485
$this->assertSame('z_unique', $info->getName());
9586
$this->assertSame('foo.bar', $info->getNamespace());
9687
$this->assertFalse($info->is2dSphere());
97-
$this->assertDeprecated(function () use ($info): void {
98-
$this->assertFalse($info->isGeoHaystack());
99-
});
10088
$this->assertFalse($info->isSparse());
10189
$this->assertFalse($info->isText());
10290
$this->assertTrue($info->isTtl());
@@ -174,32 +162,6 @@ public function testIs2dSphere(): void
174162
$this->assertSame('pos_2dsphere', $info->getName());
175163
$this->assertSame('foo.bar', $info->getNamespace());
176164
$this->assertTrue($info->is2dSphere());
177-
$this->assertDeprecated(function () use ($info): void {
178-
$this->assertFalse($info->isGeoHaystack());
179-
});
180-
$this->assertFalse($info->isSparse());
181-
$this->assertFalse($info->isText());
182-
$this->assertFalse($info->isTtl());
183-
$this->assertFalse($info->isUnique());
184-
}
185-
186-
public function testIsGeoHaystack(): void
187-
{
188-
$info = new IndexInfo([
189-
'v' => 2,
190-
'key' => ['pos2' => 'geoHaystack', 'x' => 1],
191-
'name' => 'pos2_geoHaystack_x_1',
192-
'ns' => 'foo.bar',
193-
]);
194-
195-
$this->assertSame(2, $info->getVersion());
196-
$this->assertSame(['pos2' => 'geoHaystack', 'x' => 1], $info->getKey());
197-
$this->assertSame('pos2_geoHaystack_x_1', $info->getName());
198-
$this->assertSame('foo.bar', $info->getNamespace());
199-
$this->assertFalse($info->is2dSphere());
200-
$this->assertDeprecated(function () use ($info): void {
201-
$this->assertTrue($info->isGeoHaystack());
202-
});
203165
$this->assertFalse($info->isSparse());
204166
$this->assertFalse($info->isText());
205167
$this->assertFalse($info->isTtl());
@@ -220,9 +182,6 @@ public function testIsText(): void
220182
$this->assertSame('title_text_description_text', $info->getName());
221183
$this->assertSame('foo.bar', $info->getNamespace());
222184
$this->assertFalse($info->is2dSphere());
223-
$this->assertDeprecated(function () use ($info): void {
224-
$this->assertFalse($info->isGeoHaystack());
225-
});
226185
$this->assertFalse($info->isSparse());
227186
$this->assertTrue($info->isText());
228187
$this->assertFalse($info->isTtl());

0 commit comments

Comments
 (0)