title: how to make a variable a unique key in mongoose?
body: <p>For example if I have this schema</p>
  
  <pre class="lang-js prettyprint-override"><code>var userSchema = mongoose.Schema({
      username: String,
      email: String,
      password: String,
      _todo: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Todo'}]
  });
  </code></pre>
  
  <p>I would like the username to be a unique key that cannot be duplicated by other users. How can I do this?</p>