title: mongoose - How can I set the role field with only predefined options
body: <p>Here's my user Schema :</p>
  <pre><code>const userSchema = new mongoose.Schema({
    username: {
        type: String,
        validate: function (v) {
            return /([0-9a-zA-Z])\w{6,}/.test(v);
        },
        required: [true, &quot;Username required&quot;],
    },
    passwordHash: {
        type: String,
        required: [true, &quot;PasswordHash required&quot;],
    },
    role: {
        type: String,
        required: [true, &quot;User role required&quot;],
    },});
  </code></pre>
  <p>How can I make the role field as an array of two items -admin and manager, where the user can only choose between those two options?</p>