title: Mongoose, resolve path in embedded array
body: <p>I have the following Mongoose schema:</p>
  
  <pre><code>var WeekSchema = new Schema({
      days: [{
          name: String
      }]
  });
  </code></pre>
  
  <p>and I want to get 'name' and do something with it (lets assume a validation).
  So, I try to validate using the following code:</p>
  
  <pre><code>WeekSchema.path('days.name').validate(function(value){
      return /monday|tuesday|wednesday|thursday|friday|saturday|sunday/i.test(value);
  }, 'Invalid day');
  </code></pre>
  
  <p>but i get the error: </p>
  
  <pre><code>WeekSchema.path('days.name').validate(function(value){
                              ^
  TypeError: Cannot call method 'validate' of undefined
  </code></pre>
  
  <p>in fact if I print the resolved path with</p>
  
  <pre><code>console.log(WeekSchema.path('days.name'));
  </code></pre>
  
  <p>I have 'undefined'.</p>
  
  <p>The question is, how can I get 'name' by using its path?</p>