MongoDB Documentation, Release 3.0.4 To view the query plan statistics, use the explain("executionStats") method: The explain() method returns the following results: When run with an index, the query scanned 3 index entries and 3 documents to return 3 matching documents. Without the index, to return the 3 matching documents, the query had to scan the whole collection, scanning 10 documents. To manually compare the performance of a query using more than one index, you can use the hint() method in conjunction with the explain() method. Consider the following query: 113 3.3. MongoDB CRUD Tutorials Compare Performance of Indexes db.inventory.find( { quantity: { $gte: 100, $lte: 200 } } ).explain("executionStats") { "queryPlanner" : { "plannerVersion" : 1, ... "winningPlan" : { "stage" : "FETCH", "inputStage" : { "stage" : "IXSCAN", "keyPattern" : { "quantity" : 1 }, ... } }, "rejectedPlans" : [ ] }, "executionStats" : { "executionSuccess" : true , "nReturned" : 3, "executionTimeMillis" : 0, "totalKeysExamined" : 3, "totalDocsExamined" : 3, "executionStages" : { ... }, ... }, ... } • queryPlanner.winningPlan.inputStage.stage displays IXSCAN to indicate index use. • executionStats.nReturned displays 3 to indicate that the query matches and returns three documents. • executionStats.totalKeysExamined display 3 to indicate that MongoDB scanned three index en- tries. • executionStats.totalDocsExamined display 3 to indicate that MongoDB scanned three documents. db.inventory.createIndex( { quantity: 1 } )