Annotation Interface GeoSpatialIndexed


@Target({FIELD,ANNOTATION_TYPE}) @Retention(RUNTIME) public @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
  • Element Details

    • name

      String name
      Index name either as plain value or as template 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
       
       @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;
       }
       
       
      resolves in the following index structures
       
       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 String by default.
      Default:
      ""
    • useGeneratedName

      boolean useGeneratedName
      If 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 min
      Minimum value for indexed values.
      Returns:
      -180 by default.
      Default:
      -180
    • max

      int max
      Maximum value for indexed values.
      Returns:
      +180 by default.
      Default:
      180
    • bits

      int bits
      Bits of precision for boundary calculations.
      Returns:
      26 by default.
      Default:
      26
    • type

      The type of the geospatial index. Default is GeoSpatialIndexType.GEO_2D
      Returns:
      GeoSpatialIndexType.GEO_2D by default.
      Since:
      1.4
      Default:
      GEO_2D
    • bucketSize

      @Deprecated double bucketSize
      Deprecated.
      since MongoDB server version 4.4
      The bucket size for GeoSpatialIndexType.GEO_HAYSTACK indexes, in coordinate units.
      Returns:
      1.0 by default.
      Since:
      1.4
      Default:
      1.0
    • additionalField

      String additionalField
      The name of the additional field to use for GeoSpatialIndexType.GEO_HAYSTACK indexes
      Returns:
      empty String by default.
      Since:
      1.4
      Default:
      ""