Class ClusteredIndexOptions

java.lang.Object
com.mongodb.client.model.ClusteredIndexOptions

public class ClusteredIndexOptions extends Object
Options for cluster index on a collection.
Since:
4.7
See Also:
Since server release
5.3
  • Constructor Details

    • ClusteredIndexOptions

      public ClusteredIndexOptions(Bson key, boolean unique)
      Construct an instance with the required options.
      Parameters:
      key - the index key, which currently must be {_id: 1}
      unique - whether the index entries must be unique, which currently must be true
  • Method Details

    • getKey

      public Bson getKey()
      Gets the index key.
      Returns:
      the index key
    • isUnique

      public boolean isUnique()
      Gets whether the index entries must be unique
      Returns:
      whether the index entries must be unique
    • getName

      @Nullable public String getName()
      Gets the index name
      Returns:
      the index name
    • name

      public ClusteredIndexOptions name(String name)
      Sets the index name
      Parameters:
      name - the index name
      Returns:
      this
    • toString

      public String toString()
      Overrides:
      toString in class Object