I get the error uncaught exception: TypeError: doc.addresses.append is not a function

I get the error uncaught exception: TypeError: doc.addresses.append is not a function

我有这样的结构:

_id: ObjectId("3c4b1475238d3b4dd5000001"),
username: "kris",
addresses: 
[
      {
        name: "home",
        street: "123 Some Ave",
        city: "Cul City",
        state: "CA",
        zip: 12345
      },

      {
        name: "work",
        street: "1234 Sea Blvd",
        city: "Cul City",
        state: "CA",
        zip: 54321
      }
]

我正在尝试这样做:

UID=ObjectId("3c4b1475238d3b4dd5000001")
doc=db.users.findOne({_id: UID})
new_address={name:'work', street:'17w. 18th St', city: 'New York', state:'NY', zip:10011}
doc['addresses'].append(new_address)

但是我得到这个错误: 未捕获的异常:类型错误:doc.addresses.append 不是函数: 我该如何解决?

附加到数组的正确 javascript 方法是 push

所以,而不是:

doc['addresses'].append(new_address)

使用:

doc['addresses'].push(new_address)