Query Analysis after Indexes
In the Query Analysis section, you analyzed the performance of a query that did not have suitable indexes to support its query condition. Because of this, the query scanned all 23539
documents in the collection to return 484
matching documents. Now that you have added an index on the year
field, let's see how the query execution stats have changed.
The following query prints the execution statistics for the same query:
db.movies.explain("executionStats").find( { "year" : 2015 }, { "title" : 1, "awards.wins" : 1 } ).sort( {"awards.wins" : -1} )
The output for this is slightly different than the previous one, as shown in the following...