Skip to content

Commit 40c95c5

Browse files
committed
PHPLIB-1512: Remove IndexInfo::isGeoHaystack() method
1 parent 7409a55 commit 40c95c5

File tree

4 files changed

+1
-76
lines changed

4 files changed

+1
-76
lines changed

UPGRADE-2.0.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ UPGRADE FROM 1.x to 2.0
66
* The `MongoDB\ChangeStream::CURSOR_NOT_FOUND` constant is now private.
77
* The `MongoDB\Operation\Watch::FULL_DOCUMENT_DEFAULT` constant has been
88
removed.
9+
* The `MongoDB\Model\IndexInfo::isGeoHaystack` method has been removed.
910

1011
GridFS
1112
------

src/Model/IndexInfo.php

-12
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,6 @@ public function is2dSphere(): bool
110110
return array_search('2dsphere', $this->getKey(), true) !== false;
111111
}
112112

113-
/**
114-
* Return whether or not this index is of type geoHaystack.
115-
*
116-
* @deprecated Since 1.16: MongoDB 5.0 removes support for geoHaystack indexes.
117-
*/
118-
public function isGeoHaystack(): bool
119-
{
120-
@trigger_error('MongoDB 5.0 removes support for "geoHaystack" indexes, the method "IndexInfo::isGeoHaystack()" will be removed in a future release', E_USER_DEPRECATED);
121-
122-
return array_search('geoHaystack', $this->getKey(), true) !== false;
123-
}
124-
125113
/**
126114
* Return whether this is a sparse index.
127115
*

tests/Model/IndexInfoFunctionalTest.php

-23
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

-41
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)