title: Mongoose validate array of subdocuments
body: <p>I have the following schema</p>
  
  <pre><code>const TextSchema = new Schema({
    locale: String,
    contexts: [{
      field: String,
      channel: String,
    }],
  });
  </code></pre>
  
  <p>I would like to add a validation to each context that ensures that either field or channel is set.</p>
  
  <p>I have tried extracting the context to a separate schema and setting the validation like below but it only validates the whole array instead of each context.</p>
  
  <pre><code>const TextSchema = new Schema({
    locale: String,
    contexts: {
      type: [ContextSchema],
      validate: validateContext,
    },
  });
  </code></pre>