title: How does the order of compound indexes matter in MongoDB performance-wise?
body: <p>We need to create a compound index in the same order as the parameters are being queried. Does this order matter performance-wise at all?</p>
  
  <p>Imagine we have a collection of all humans on earth with an index on <code>sex</code> (99.9% of the time "male" or "female", but string nontheless (not binary)) and an index on <code>name</code>.</p>
  
  <p>If we would want to be able to select all people of a certain <code>sex</code> with a certain <code>name</code>, e.g. all "male"s named <em>"John"</em>, is it better to have a compound index with <code>sex</code> first or <code>name</code> first? Why (not)?</p>