getIndexes method
Analogue of mongodb shell method db.collection.getIndexes()
Returns an array that holds a list of documents that identify and describe
the existing indexes on the collection. You must call getIndexes()
on a collection
Implementation
Future<List<Map<String, dynamic>>> getIndexes() {
if (db.masterConnection.serverCapabilities.supportsOpMsg) {
return listIndexes().toList();
}
if (db.masterConnection.serverCapabilities.listIndexes) {
return ListIndexesCursor(db, this).stream.toList();
} else {
/// Pre MongoDB v3.0 API
var selector = <String, dynamic>{};
selector['ns'] = fullName();
return Cursor(
db, DbCollection(db, DbCommand.SYSTEM_INDEX_COLLECTION), selector)
.stream
.toList();
}
}