Skip to content
js
;(async () => {
  try {
    // 更新一个:将 name 为 foo 的数据的 age 改为 20
    const res = await Student.updateOne({ name: 'foo'}, { age: 20 })
    // 更新多个
    const res = await Student.updateMany({ name: 'foo'}, { age: 20 })
  } catch (error) {
    console.log(error)
  }  

  conn.close()
})()