title: Deleting nested document from mongo array
body: <p>this is my mongo doc :</p>
  
  <pre><code>{
      "_id" : ObjectId("51f22f6784aefaa97d7e533e"),
      "group_name" : "demo",
      "privileges" : [
          "User Group",
          "Profile Images",
          "Advertisement"
      ],
      "users" : [
          {
              "full_name" : "aap",
              "password" : "as",
              "status" : "Active",
              "user_name" : "as"
          },
          {
              "full_name" : "b",
              "user_name" : "b",
              "password" : "b",
              "status" : "Active"
          },
          {
              "full_name" : "prashant",
              "user_name" : "pt123",
              "status" : "Active"
          }
      ]
  }
  </code></pre>
  
  <p>I want to find all records having "group_name":"demo" delete particular record having  "user_name":"pt123" form users array. 
  I have tried </p>
  
  <pre><code> db.users.update({"group_name":"demo"}, {$pull:{"users.user_name":"pt123"}})
  </code></pre>
  
  <p>but showing no effect. Where am i lacking?
  Please Help
  My java code is  </p>
  
  <pre><code>BasicDBObject del = new BasicDBObject("group_name", z);
  del.put("users.user_name", x);
  BasicDBObject delquery=new BasicDBObject("$match",del);
  con.remove(delquery);
  </code></pre>