title: Get All Indexes with names , types, properties in Mongo java
body: <p>I want to retrieve all the indexes from Mongo using java. I am using Morphia but am open to using Mongo-Java-Driver as well. I would like to list and iterate over all the indexes , as well as get their types, properties, names. How can I do so?</p>
  <p>I tried the following :</p>
  <pre><code>  MongoCollection mongoCollection = client.getDatabase(&quot;mofinance&quot;).getCollection(&quot;FinanceDetails&quot;);
              mongoCollection.listIndexes();
  </code></pre>
  <p>But this gives me LinkedHashMap object which contains key and value pairs and  I have to iterate using custom recursive code. I want something like index.getName(), index.unique(), index.sparse..</p>
  <p>Any suggestions. Thanks</p>