MongoDB array deletion problem

  mongodb, question

For example, tables contain

{
 {
 "id":1,
 "arr":[
 {"subid":1,"name":"s1"},
 {"subid":2,"name":"s2"}
 ]
 }
 }

How can I write to delete the statement that satisfies subid=2 in arr?
I use update (“tables”, “id”: 1}, {$ pull: {“arr” :{ $ elemmatch: {“subid”: 2}}}}})
Invalid, why?
The final result I want is

{
 {
 "id":1,
 "arr":[
 {"subid":1,"name":"s1"}
 ]
 }
 }
db.tables.update({"id":1},{
 $pull:{
 arr:{
 subid:2
 }
 }
 })