Skip to main content

What is index intersection?

Mid MongoDB
Quick Answer Index intersection allows MongoDB to use two separate indexes to satisfy a single query (instead of requiring a compound index). MongoDB ANDs the results from both indexes. In practice, a well-designed compound index almost always outperforms index intersection. Check explain() output - if you see "AND_HASH" or "AND_SORTED" stages, MongoDB is using index intersection.

Answer

MongoDB can combine multiple indexes to satisfy a query, useful when no single index covers all fields.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice