@@ -343,28 +343,21 @@ public List<DBObject> getIndexInfo() {
343343 List <DBObject > list = new ArrayList <DBObject >();
344344
345345 if (db .isServerVersionAtLeast (asList (2 , 7 , 6 ))) {
346- CommandResult res = _db .command (new BasicDBObject ("listIndexes" , getName ()).append ("cursor" , new BasicDBObject ()),
347- ReadPreference .primary ());
346+ CommandResult res = _db .command (new BasicDBObject ("listIndexes" , getName ()), ReadPreference .primary ());
348347 if (!res .ok () && res .getCode () == 26 ) {
349348 return list ;
350349 }
351350 res .throwOnError ();
352- List <DBObject > indexes = (List <DBObject >) res .get ("indexes" );
353- if (indexes != null ) {
354- for (DBObject indexDocument : indexes ) {
355- list .add (indexDocument );
356- }
357- } else {
358- QueryResultIterator iterator = new QueryResultIterator (res , db .getMongo (), 0 , DefaultDBDecoder .FACTORY .create (),
359- res .getServerUsed ());
360- try {
361- while (iterator .hasNext ()) {
362- DBObject collectionInfo = iterator .next ();
363- list .add (collectionInfo );
364- }
365- } finally {
366- iterator .close ();
351+
352+ QueryResultIterator iterator = new QueryResultIterator (res , db .getMongo (), 0 , DefaultDBDecoder .FACTORY .create (),
353+ res .getServerUsed ());
354+ try {
355+ while (iterator .hasNext ()) {
356+ DBObject collectionInfo = iterator .next ();
357+ list .add (collectionInfo );
367358 }
359+ } finally {
360+ iterator .close ();
368361 }
369362 } else {
370363 BasicDBObject cmd = new BasicDBObject ("ns" , getFullName ());
0 commit comments