Shing Lyu

Check MongoDB index usage statistics

By Shing Lyu    

Disclaimer: The views expressed here are my own; they do not reflect the views of my current and past employers.

Run this command to get the usage of each index:

db.<collection>.aggregate( [ { $indexStats: { } } ] )

This is useful for figuring out which index is underutilized. You can find an example output in the documentation.

Want to learn Rust? Check out my books:

Also available on O'Reilly and Amazon