@@ -343,28 +343,21 @@ public List<DBObject> getIndexInfo() {
343
343
List <DBObject > list = new ArrayList <DBObject >();
344
344
345
345
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 ());
348
347
if (!res .ok () && res .getCode () == 26 ) {
349
348
return list ;
350
349
}
351
350
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 );
367
358
}
359
+ } finally {
360
+ iterator .close ();
368
361
}
369
362
} else {
370
363
BasicDBObject cmd = new BasicDBObject ("ns" , getFullName ());
0 commit comments