title: Set properties in multi-level mongoose schema
body: <p>This is my schema:</p>
  
  <pre><code>var userschema = new mongoose.Schema({
  
    user: String,
    imagen: [{ 
  
                title: String,
                name: String,
                path: String,
  
             }]
  
  });
  </code></pre>
  
  <p>And I'm trying this:</p>
  
  <pre><code> usermodel.findOne({ user: req.session.user }, function(err, user){
  
       var img = user.imagen[user.imagen.length];
  
       img.title = req.body.title;
  
       user.save(function(err){
  
          if(err) { throw err; }
  
       });
  
   });
  </code></pre>
  
  <p>An the console returns <code>TypeError: Cannot set property 'title' of undefined</code>. So, I don't know why is undefined. I think I have to create a new array element, and then set the properties of that array element, but I don't no how. Any solution to this...?</p>
  
  <p>Thank's advance!</p>