mongoose的findByIdAndUpdate返回的不是最新的数据
      
      
      
    
    mongoose的findByIdAndUpdate方法不是返回更新后的最新数据吗?为什么我取出来的是旧的数据,事实上数据库中数据是更新了的
      3 回复
    
    A.findByIdAndUpdate(id, update, options, callback) // executes
A.findByIdAndUpdate(id, update, options)  // returns Query
A.findByIdAndUpdate(id, update, callback) // executes
A.findByIdAndUpdate(id, update)           // returns Query
A.findByIdAndUpdate()                     // returns Query
http://mongoosejs.com/docs/api.html#model_Model.findByIdAndUpdate
@gjc9620 OK,thx
有一个属性 new,可以控制返回的数据,默认的是 false 返回旧数据 new: bool - true to return the modified document rather than the original. defaults to false