Class DatabaseShardingOptions

  • Direct Known Subclasses:
    CompositeShardingOptions

    public class DatabaseShardingOptions
    extends ShardingOptions
    Database Sharding options. Provides configuration options that are specifically used for Database Sharding strategy.
    Author:
    Shashank Sharma
    • Constructor Detail

      • DatabaseShardingOptions

        public DatabaseShardingOptions​(List<String> defaultDatabaseHints)
        Construct the Database Sharding options using the list of default database hints.
        Parameters:
        defaultDatabaseHints - Default database hints applicable to all the collections using the MongoTemplate
    • Method Detail

      • withIntegerStreamHints

        public static DatabaseShardingOptions withIntegerStreamHints​(IntStream stream)
        A static method to construct DatabaseShardingOptions from an integer stream. This method can be used to create an DatabaseShardingOptions for an integer range, say 0-10 DatabaseShardingOptions.withIntegerStreamHints(IntStream.range(0, 10));
        Parameters:
        stream - Integer Stream
        Returns:
        DatabaseShardingOptions object
      • getDefaultDatabaseHint

        public String getDefaultDatabaseHint()
        Get the default database hint if set. If the default hint is not set, then the first hint in the list of hints will be considered for default.
        Returns:
        default hint
      • validateDatabaseHint

        public boolean validateDatabaseHint​(String databaseName,
                                            String hint)
        Description copied from class: ShardingOptions
        Validate if a particular hint is valid for the sharding options or not.
        Overrides:
        validateDatabaseHint in class ShardingOptions
        Parameters:
        databaseName - Base Database Name
        hint - hint
        Returns:
        true if the hint passed is valid