Mongodb(猫鼬)更新

时间:2021-03-18 15:16:37

标签: mongodb mongoose

我是 mongodb 的新手。我想为 ID 为“6007fccc89587095870958”的个人更新/添加角色为“父亲”的父母的 ID

{   
     _id : ObjectID("6007fccc89587095870958"),
      name: 'John Smith',
      gender: 'male',
      birth: {
        date: '12/07/2003'
        place: 'NY'
        parents: [
          {
            id: '',
            role: 'father'
          },
          {
            id: '',
            role: 'mother'
          }
        ]
   
     }
}

最好的方法是什么?

0 个答案:

没有答案