Annotation Type ShardOptions


  • @Documented
    @Retention(RUNTIME)
    @Target(ANNOTATION_TYPE)
    @MorphiaExperimental
    public @interface ShardOptions
    Specifies options to be applied when sharding.
    Since:
    2.3
    Developer note.
    This is an experimental item. Its function and presence are subject to change. Feedback on features and usability extremely welcome.
    • Element Detail

      • numInitialChunks

        int numInitialChunks
        Optional. Specifies the minimum number of chunks to create initially when sharding an empty collection with a hashed shard key.
        Returns:
        the number of chunks
        Default:
        -1
      • presplitHashedZones

        boolean presplitHashedZones
        Optional. Specify true to perform initial chunk creation and distribution for an empty or non-existing collection based on the defined zones and zone ranges for the collection. For hashed sharding only.
        Returns:
        true for presplits
        See Also:
        ShardKeyType.HASHED
        Default:
        false
      • unique

        boolean unique
        Optional. Specify true to ensure that the underlying index enforces a unique constraint.
        Returns:
        true for unique constraints
        Default:
        false