title: Mongoose indexes at both field and schema levels
body: <p>I understand that indexing can be a valuable tool for quickly retrieving data, if implemented properly. I would like to be able to scan my documents for a certain field value <em>or</em> a combination of field values.</p>
  
  <p>There are two fields I would be indexing (category, tags). Category is a string and tags is an array. I need to be able to query for items in a specific category and/or items that contain a specific tag.</p>
  
  <p>Here are three examples:</p>
  
  <ol>
  <li>Show me all of the documents in the category: "cars"</li>
  <li>Show me all of the documents that contain the tag: "electric"</li>
  <li>Show me all of the documents in the "cars" category that contain the "electric" tag</li>
  </ol>
  
  <p>Will a schema level index for both fields suffice for all three scenarios?</p>
  
  <pre><code>docSchema.index({category:1, tags:1});
  </code></pre>
  
  <p>Or do I also need to define them at the field level, to support the scenarios when I am only searching through a single field? </p>
  
  <pre><code>docSchema = mongoose.Schema({
      category: {
          type: String,
          index: true
      },
      tags: {
          type: [String],
          index: true
      }
  });
  </code></pre>