title: How to remove a reference in mongodb?
body: <p>I have the following object</p>
  
  <pre><code>   {
          "_id" : ObjectId("4b8699aa3b97dc29dd000000"),
          "name" : "test",
          "email" : "test",
          "url" : "test",
          "items" : [
                  {
                          "$ref" : "item",
                          "$id" : ObjectId("4b866a043b97dc22a9000001")
                  }
          ]}
  </code></pre>
  
  <p>How can I remove the reference from items? I have the objectid for the reference?
  I tried the following, which does work for normal list items but not with a reference.</p>
  
  <pre><code>db.foo.update(foo, {$pull: {'items': {'$id': ObjectId("4b866a043b97dc22a9000001") } } })
  </code></pre>