How hideIndex() Works in MongoDB

MongoDB introduced the db.collection.hideIndex() method in MongoDB 4.4.

This method hides an existing index from the query planner. This allows you to evaluate the potential impact of dropping an index without actually dropping the index.

If hiding it has a negative impact, you can use db.collection.unhideIndex() to unhide the index. This saves you from having to drop the index, then recreate it.

Continue reading