In MongoDB, you can use the cursor.explain()
method or the db.collection.explain()
method to determine whether or not a query uses an index.
These methods enable you to view the query plan for the query, which includes whether or not it uses an index.
Continue reading