I know db.collection.getIndexes()
can return all the indexes in collection
, but sometimes it will return a long result if collection
has many indexes, and this will make it difficult for you to find whether a certain field is indexed.
So how can you check whether a certain field is indexed in mongodb?