Class IndexModel

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

public class IndexModel extends Object
A model describing the creation of a single index.
Since:
3.0
MongoDB documentation
Index options
  • Constructor Details

    • IndexModel

      public IndexModel(Bson keys)
      Construct an instance with the given keys.
      Parameters:
      keys - the index keys
    • IndexModel

      public IndexModel(Bson keys, IndexOptions options)
      Construct an instance with the given keys and options.
      Parameters:
      keys - the index keys
      options - the index options
  • Method Details

    • getKeys

      public Bson getKeys()
      Gets the index keys.
      Returns:
      the index keys
    • getOptions

      public IndexOptions getOptions()
      Gets the index options.
      Returns:
      the index options
    • toString

      public String toString()
      Overrides:
      toString in class Object