MongoDB Documentation, Release 3.0.4 Query with No Index Query with Index Chapter 3. MongoDB CRUD Operations 112 The difference between the number of matching documents and the number of examined documents may suggest that, to improve efficiency, the query might benefit from the use of an index. To support the query on the quantity field, add an index on the quantity field: • queryPlanner.winningPlan.stage displays COLLSCAN to indicate a collection scan. • executionStats.nReturned displays 3 to indicate that the query matches and returns three documents. • executionStats.totalDocsExamined display 10 to indicate that MongoDB had to scan ten docu- ments (i.e. all documents in the collection) to find the three matching documents. { "queryPlanner" : { "plannerVersion" : 1, ... "winningPlan" : { "stage" : "COLLSCAN", ... } }, "executionStats" : { "executionSuccess" : true , "nReturned" : 3, "executionTimeMillis" : 0, "totalKeysExamined" : 0, "totalDocsExamined" : 10, "executionStages" : { "stage" : "COLLSCAN", ... }, ... }, ... } db.inventory.find( { quantity: { $gte: 100, $lte: 200 } } ).explain("executionStats") { "_id" : 2, "item" : "f2", "type" : "food", "quantity" : 100 } { "_id" : 3, "item" : "p1", "type" : "paper", "quantity" : 200 } { "_id" : 4, "item" : "p2", "type" : "paper", "quantity" : 150 } db.inventory.find( { quantity: { $gte: 100, $lte: 200 } } ) The following query retrieves documents where the quantity field has a value between 100 and 200 , inclusive: The query returns the following documents: To view the query plan selected, use the explain("executionStats") method: explain() returns the following results: