In the MongoDB shell, how can you tell if an index was used with a query?

  •  db.customers.find({lastName: ‘smith’}).explain()
  •  db.customers.find({lastName: ‘smith’}).perf()
  •  db.customers.find({lastName: ‘smith’}).plan()
  •  db.customers.find({lastName: ‘smith’}).usedIndex()

Leave a Reply

Your email address will not be published. Required fields are marked *