Module spring.data.mongodb
Annotation Interface GeoSpatialIndexed
Mark a field to be indexed using MongoDB's geospatial indexing feature.
- Author:
- Jon Brisbin, Laurent Canet, Thomas Darimont, Christoph Strobl, Mark Paluch
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe name of the additional field to use forGeoSpatialIndexType.GEO_HAYSTACKindexesintBits of precision for boundary calculations.doubleDeprecated.since MongoDB server version 4.4intMaximum value for indexed values.intMinimum value for indexed values.Index name either as plain value or astemplate expression.The type of the geospatial index.booleanIf set to true then MongoDB will ignore the given index name and instead generate a new name.
-
Element Details
-
name
String nameIndex name either as plain value or astemplate expression.
The name will only be applied as is when defined on root level. For usage on nested or embedded structures the provided name will be prefixed with the path leading to the entity.
The structure below
resolves in the following index structures@Document class Root { Hybrid hybrid; Nested nested; } @Document class Hybrid { @GeoSpatialIndexed(name="index") Point h1; @GeoSpatialIndexed(name="#{@myBean.indexName}") Point h2; } class Nested { @GeoSpatialIndexed(name="index") Point n1; }db.root.createIndex( { hybrid.h1: "2d" } , { name: "hybrid.index" } ) db.root.createIndex( { nested.n1: "2d" } , { name: "nested.index" } ) db.hybrid.createIndex( { h1: "2d" } , { name: "index" } ) db.hybrid.createIndex( { h2: "2d"} , { name: the value myBean.getIndexName() returned } )- Returns:
- empty
Stringby default.
- Default:
- ""
-
useGeneratedName
boolean useGeneratedNameIf set to true then MongoDB will ignore the given index name and instead generate a new name. Defaults to false.- Returns:
- false by default.
- Since:
- 1.5
- Default:
- false
-
min
int minMinimum value for indexed values.- Returns:
- -180 by default.
- Default:
- -180
-
max
int maxMaximum value for indexed values.- Returns:
- +180 by default.
- Default:
- 180
-
bits
int bitsBits of precision for boundary calculations.- Returns:
- 26 by default.
- Default:
- 26
-
type
GeoSpatialIndexType typeThe type of the geospatial index. Default isGeoSpatialIndexType.GEO_2D- Returns:
GeoSpatialIndexType.GEO_2Dby default.- Since:
- 1.4
- Default:
- GEO_2D
-
bucketSize
Deprecated.since MongoDB server version 4.4The bucket size forGeoSpatialIndexType.GEO_HAYSTACKindexes, in coordinate units.- Returns:
- 1.0 by default.
- Since:
- 1.4
- Default:
- 1.0
-
additionalField
String additionalFieldThe name of the additional field to use forGeoSpatialIndexType.GEO_HAYSTACKindexes- Returns:
- empty
Stringby default. - Since:
- 1.4
- Default:
- ""
-