Today I Learned (2020-06-14)

MongoDB explain()

The reference

What is explain()

  • how many documents were scanned
  • how many documents were returned
  • which index was used
  • how long the query took to be executed
  • which alternative execution plans were evaluated

Example:

db.tils.explain('executionStats')
    .find({'status':'archive'})
    .sort({'created':-1})

<< Prev | Next >>