Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c596a22

Browse files
JAVA-3684: deprecate geohaystack (#659)
geoHaystack was deprecated in MongoDB 4.4
1 parent a3ef19b commit c596a22

File tree

9 files changed

+11
-83
lines changed

9 files changed

+11
-83
lines changed

‎docs/reference/content/builders/indexes.md‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -123,19 +123,3 @@ This example specifies a 2d index on the `points` field:
123123
geo2d("points")
124124
```
125125

126-
127-
#### geoHaystack
128-
129-
To specify a [geoHaystack]({{< docsref "core/geohaystack/" >}}) index key, use the `geoHaystack` method.
130-
131-
{{% note class="important"%}}
132-
For queries that use spherical geometry, a 2dsphere index is a better option than a haystack index. 2dsphere indexes allow field reordering;
133-
geoHaystack indexes require the first field to be the location field. Also, geoHaystack indexes are only usable via commands and so always
134-
return all results at once.
135-
{{% /note %}}
136-
137-
This example specifies a geoHaystack index on the `position` field and an ascending index on the `type` field:
138-
139-
```java
140-
geoHaystack("position", ascending("type"))
141-
```

‎docs/reference/content/driver-reactive/tutorials/indexes.md‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -163,23 +163,6 @@ collection.createIndex(Indexes.geo2dsphere("contact.location"))
163163
.subscribe(new PrintToStringSubscriber<String>());
164164
```
165165

166-
### geoHaystack
167-
168-
To create a specification for a [`geoHaystack` index]({{<docsref "core/geohaystack/" >}}), use the [`Indexes.geoHaystack`]({{< apiref "mongodb-driver-core" "com/mongodb/client/model/Indexes.html#geoHaystack(java.lang.String,org.bson.conversions.Bson)" >}}) method. `geoHaystack` indexes can improve performance on queries that use flat geometries.
169-
170-
The following example creates a `geoHaystack` index on the `contact.location` field and an ascending index on the `stars` field:
171-
172-
```java
173-
IndexOptions haystackOption = new IndexOptions().bucketSize(1.0);
174-
collection.createIndex(
175-
Indexes.geoHaystack("contact.location", Indexes.ascending("stars")),
176-
haystackOption)
177-
.subscribe(new PrintToStringSubscriber<String>());
178-
```
179-
180-
181-
To query a haystack index, use the [`geoSearch`]({{<docsref "reference/command/geoSearch" >}}) command.
182-
183166
## IndexOptions
184167

185168
```java

‎docs/reference/content/driver-scala/builders/indexes.md‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,3 @@ This example specifies a 2d index on the `points` field:
117117
```scala
118118
geo2d("points")
119119
```
120-
121-
122-
#### geoHaystack
123-
124-
To specify a [geoHaystack]({{< docsref "core/geohaystack/" >}}) index key, use the `geoHaystack` method.
125-
126-
{{% note class="important"%}}
127-
For queries that use spherical geometry, a 2dsphere index is a better option than a haystack index. 2dsphere indexes allow field reordering;
128-
geoHaystack indexes require the first field to be the location field. Also, geoHaystack indexes are only usable via commands and so always
129-
return all results at once.
130-
{{% /note %}}
131-
132-
This example specifies a geoHaystack index on the `position` field and an ascending index on the `type` field:
133-
134-
```scala
135-
geoHaystack("position", ascending("type"))
136-
```

‎docs/reference/content/driver-scala/tutorials/indexes.md‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -156,23 +156,6 @@ collection.createIndex(Indexes.geo2dsphere("contact.location"))
156156
.printResults()
157157
```
158158

159-
### geoHaystack
160-
161-
To create a specification for a [`geoHaystack` index]({{<docsref "core/geohaystack/" >}}), use the [`Indexes.geoHaystack`]({{< apiref "mongo-scala-driver" "org/mongodb/scala/model/Indexes$.html#geoHaystack(fieldName:String,additional:org.mongodb.scala.bson.conversions.Bson):org.mongodb.scala.bson.conversions.Bson" >}}) method. `geoHaystack` indexes can improve performance on queries that use flat geometries.
162-
163-
The following example creates a `geoHaystack` index on the `contact.location` field and an ascending index on the `stars` field:
164-
165-
```scala
166-
val haystackOption = IndexOptions().bucketSize(1.0)
167-
collection.createIndex(
168-
Indexes.geoHaystack("contact.location", Indexes.ascending("stars")),
169-
haystackOption)
170-
.printResults()
171-
```
172-
173-
174-
To query a haystack index, use the [`geoSearch`]({{<docsref "reference/command/geoSearch" >}}) command.
175-
176159
## IndexOptions
177160

178161
```scala

‎docs/reference/content/driver/tutorials/indexes.md‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,6 @@ The following example creates a `2dsphere` index on the `"contact.location"` fie
147147
collection.createIndex(Indexes.geo2dsphere("contact.location"));
148148
```
149149

150-
### geoHaystack
151-
152-
To create a specification for a [`geoHaystack` index]({{<docsref "core/geohaystack/" >}}), use the [`Indexes.geoHaystack`]({{< apiref "mongodb-driver-core" "com/mongodb/client/model/Indexes.html#geoHaystack(java.lang.String,org.bson.conversions.Bson)" >}}) method. `geoHaystack` indexes can improve performance on queries that use flat geometries.
153-
154-
The following example creates a `geoHaystack` index on the `contact.location` field and an ascending index on the `stars` field:
155-
156-
```java
157-
IndexOptions haystackOption = new IndexOptions().bucketSize(1.0);
158-
collection.createIndex(
159-
Indexes.geoHaystack("contact.location", Indexes.ascending("stars")),
160-
haystackOption);
161-
```
162-
163-
164-
To query a haystack index, use the [`geoSearch`]({{<docsref "reference/command/geoSearch" >}}) command.
165-
166150
## IndexOptions
167151

168152
```java

‎driver-core/src/main/com/mongodb/client/model/IndexOptions.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,10 @@ public IndexOptions max(@Nullable final Double max) {
376376
*
377377
* @return the specified the number of units within which to group the location values for geoHaystack Indexes
378378
* @mongodb.driver.manual core/geohaystack/ geoHaystack Indexes
379+
* @deprecated geoHaystack is deprecated in MongoDB 4.4
379380
*/
380381
@Nullable
382+
@Deprecated
381383
public Double getBucketSize() {
382384
return bucketSize;
383385
}
@@ -388,7 +390,9 @@ public Double getBucketSize() {
388390
* @param bucketSize the specified the number of units within which to group the location values for geoHaystack Indexes
389391
* @return this
390392
* @mongodb.driver.manual core/geohaystack/ geoHaystack Indexes
393+
* @deprecated geoHaystack is deprecated in MongoDB 4.4
391394
*/
395+
@Deprecated
392396
public IndexOptions bucketSize(@Nullable final Double bucketSize) {
393397
this.bucketSize = bucketSize;
394398
return this;

‎driver-core/src/main/com/mongodb/client/model/Indexes.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ public static Bson geo2d(final String fieldName) {
140140
* @param additional the additional field that forms the geoHaystack index key
141141
* @return the index specification
142142
* @mongodb.driver.manual core/geohaystack geoHaystack index
143+
* @deprecated geoHaystack is deprecated in MongoDB 4.4, prefer {@link Indexes#geo2dsphere(String...)}
143144
*/
145+
@Deprecated
144146
public static Bson geoHaystack(final String fieldName, final Bson additional) {
145147
notNull("fieldName", fieldName);
146148
return compoundIndex(new BsonDocument(fieldName, new BsonString("geoHaystack")), additional);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,9 @@ public IndexRequest max(final Double max) {
396396
*
397397
* @return the specified the number of units within which to group the location values for geoHaystack Indexes
398398
* @mongodb.driver.manual core/geohaystack/ geoHaystack Indexes
399+
* @deprecated geoHaystack is deprecated in MongoDB 4.4
399400
*/
401+
@Deprecated
400402
public Double getBucketSize() {
401403
return bucketSize;
402404
}
@@ -407,7 +409,9 @@ public Double getBucketSize() {
407409
* @param bucketSize the specified the number of units within which to group the location values for geoHaystack Indexes
408410
* @return this
409411
* @mongodb.driver.manual core/geohaystack/ geoHaystack Indexes
412+
* @deprecated geoHaystack is deprecated in MongoDB 4.4
410413
*/
414+
@Deprecated
411415
public IndexRequest bucketSize(final Double bucketSize) {
412416
this.bucketSize = bucketSize;
413417
return this;

‎driver-scala/src/main/scala/org/mongodb/scala/model/Indexes.scala‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ object Indexes {
8888
* @return the index specification
8989
* @see [[http://docs.mongodb.org/manual/core/geohaystack geoHaystack index]]
9090
*/
91+
@deprecated("geoHaystack is deprecated in MongoDB 4.4", "4.2.1")
9192
def geoHaystack(fieldName: String, additional: Bson): Bson = JIndexes.geoHaystack(fieldName, additional)
9293

9394
/**

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /