• 註冊用戶


  • Lv 1

    • update(): Is meant to perform an atomic update operation against "one or more" documents matched by it's query condition in a collection. It returns the number of modified documents in it's response.

    • findOneAndUpdate(): Has the purpose of both processing an update statment on a "singular" document, as well as retrieving the content of that "singular" document. The state returned depends on the value of the "new" option as passed to the operation. Where true the "modified" document is returned. Where false the "original" document is returned before any modification. The latter form is the default option.

    ·         update()返回資料處理條數

    ·         findOneAndUpdate()返回處理後的資料

    ·         簡單來說,你需要獲取資料就用findOneAndUpdate(),只需要修改資料而不關注修改後資料那就用update()。





与 萌阔论坛 的连接断开,我们正在尝试重连,请耐心等待