findOneAndUpdate is not a function [duplicate]
问题 This question already has answers here : findAndModify or findOneAndUpdate - “is not a function” (2 answers) Closed 3 years ago . I've spent all morning googling this, and trying various fixes but I cannot figure it out. I keep getting the error "TypeError: req.user.findOneAndUpdate is not a function" when I try to run this: req.user.findOneAndUpdate({_id: req.user._id}, { $addToSet: { flashcards : { $each: cards }}}, {upsert : true}, function(err, doc) { if(err) return console.log(err); res