title: Deleting a single object from an array of objects in MongoDB
body: <p>Say we have the following collection of documents:</p>
  
  <pre class="lang-js prettyprint-override"><code>{ "_id" : ObjectId("50a69fa904c8310609600be3"), "id" : 100, "city" : "San Francisco", "friends" : [     {   "id" : 1,   "name" : "John" },  {   "id" : 2,   "name" : "Betty" },     {   "id" : 3,   "name" : "Harry" } ] }
  { "_id" : ObjectId("50a69fc104c8310609600be4"), "id" : 200, "city" : "Palo Alto", "friends" : [     {   "id" : 1,   "name" : "Carol" },     {   "id" : 2,   "name" : "Frank" },     {   "id" : 3,   "name" : "Norman" } ] }
  { "_id" : ObjectId("50a69fc304c8310609600be5"), "id" : 300, "city" : "Los Angeles", "friends" : [   {   "id" : 1,   "name" : "Fred" },  {   "id" : 2,   "name" : "Neal" },  {   "id" : 3,   "name" : "David" } ] }
      .
      .
      .  
  </code></pre>
  
  <p>Now let's say that Frank (Palo Alto, id=2) is no longer my friend, and I want to delete him from the collection. I thought the following might work, but it doesn't:</p>
  
  <pre><code>db.test.update({"city":"Palo Alto"},{"$pull":{"friends.name":"Frank"}})
  </code></pre>
  
  <p>I'd like to be able to do something like that. Delete an object within an array within a collection of documents. How do you do this?</p>