title: Push items into mongo array via mongoose
body: <p>Basically I have a mongodb collection called 'people'
  whose schema is as follows:</p>
  <pre><code>people: {
           name: String, 
           friends: [{firstName: String, lastName: String}]
          }
  </code></pre>
  <p>Now, I have a very basic express application that connects to the database and successfully creates 'people' with an empty friends array.</p>
  <p>In a secondary place in the application, a form is in place to add friends. The form takes in firstName and lastName and then POSTs with the name field also for reference to the proper people object.</p>
  <p>What I'm having a hard time doing is creating a new friend object and then &quot;pushing&quot; it into the friends array.</p>
  <p>I know that when I do this via the mongo console I use the update function with <code>$push</code> as my second argument after the lookup criteria, but I can't seem to find the appropriate way to get mongoose to do this.</p>
  <pre><code>db.people.update({name: &quot;John&quot;}, {$push: {friends: {firstName: &quot;Harry&quot;, lastName: &quot;Potter&quot;}}});
  </code></pre>