Skip to content

Commit 71259ae

Browse files
committed
JAVA-2628: Add "3" to the list of valid 2dsphere index versions.
1 parent 0194dea commit 71259ae

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

driver-core/src/main/com/mongodb/bulk/IndexRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
public class IndexRequest {
3636
private final BsonDocument keys;
3737
private static final List<Integer> VALID_TEXT_INDEX_VERSIONS = asList(1, 2, 3);
38-
private static final List<Integer> VALID_SPHERE_INDEX_VERSIONS = asList(1, 2);
38+
private static final List<Integer> VALID_SPHERE_INDEX_VERSIONS = asList(1, 2, 3);
3939
private boolean background;
4040
private boolean unique;
4141
private String name;
@@ -323,7 +323,7 @@ public Integer getSphereVersion() {
323323
*/
324324
public IndexRequest sphereVersion(final Integer sphereVersion) {
325325
if (sphereVersion != null) {
326-
isTrueArgument("sphereIndexVersion must be 1 or 2", VALID_SPHERE_INDEX_VERSIONS.contains(sphereVersion));
326+
isTrueArgument("sphereIndexVersion must be 1, 2 or 3", VALID_SPHERE_INDEX_VERSIONS.contains(sphereVersion));
327327
}
328328
this.sphereVersion = sphereVersion;
329329
return this;

driver-core/src/test/unit/com/mongodb/IndexRequestSpecification.groovy

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
package com.mongodb
1818

1919
import com.mongodb.bulk.IndexRequest
20+
import com.mongodb.client.model.Collation
2021
import com.mongodb.client.model.CollationAlternate
2122
import com.mongodb.client.model.CollationCaseFirst
2223
import com.mongodb.client.model.CollationMaxVariable
23-
import com.mongodb.client.model.Collation
2424
import com.mongodb.client.model.CollationStrength
2525
import org.bson.BsonDocument
2626
import org.bson.BsonInt32
@@ -165,6 +165,12 @@ class IndexRequestSpecification extends Specification {
165165
when:
166166
options.sphereVersion(3)
167167

168+
then:
169+
notThrown(IllegalArgumentException)
170+
171+
when:
172+
options.sphereVersion(4)
173+
168174
then:
169175
thrown(IllegalArgumentException)
170176
}

0 commit comments

Comments
 (0)