What is the difference between sending the UpdateQuery parameter to Mongoose's findOneAndUpdate function as an array or object?

后端 未结 0 802
再見小時候
再見小時候 2020-12-12 04:23

I want to toggle a boolean field in mongodb.

This code works.

await User.findOneAndUpdate(
    { _id: req.params.id },
    [{ $set: { blocked: { $not:          


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题