title: MongoDB index: object keys vs array of strings
body: <p>I'm new to the MongoDB and have been researching schema designs and indexing. I know you can index a property regardless of its value (ID, array, subdocument, etc...) but what I don't know is if there is a performance benefit to either indexing an array of strings or a nested object's keys.</p>
  
  <p>Here's an example of both scenarios that I'm contemplating (in Mongoose):</p>
  
  <pre><code>// schema
  mongoose.Schema({
      visibility: {
          usa: Boolean,
          europe: Boolean,
          other: Boolean
      }
  });
  // query
  Model.find({"visibility.usa": true});
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>// schema
  mongoose.Schema({
      visibility: [String] // strings could be "usa", "europe", and/or "other"
  });
  // query
  Model.find({visibility: "usa"});
  </code></pre>
  
  <p>Documents could have one, two, or all three visibility options.</p>
  
  <p>Furthermore, if I went with the Boolean object design, could I simple index the visibility field or would I need to put an index on usa, europe, and other?</p>