Open RealWeeks opened 8 years ago
Please don't. That's efficiency over functionality. Which is why my examples don't use it. A variety of features are lost using the findByIdAnd/findOneAnd methods
Informational comment: If I'm reading this correctly, .findOneAndUpdate
and .findByIdAndUpdate
are entirely different. http://mongoosejs.com/docs/api.html#model_Model.findOneAndUpdate
I believe findById(id)
is approximately equivalent to findOne({_id: id})
Moving forward as not adding findByIdAndUpdate
, correct @J-Weeks @gaand @jrhorn424? We can close if so.
I believe there it is OK to .findOneAndUpdate
. Note that is not what the original issue was about. I'd like to discuss if there's disagreement.
Mongoose middleware only fires on certain methods and I think we want to have that available. The findAnd methods are not among them. @jrhorn424 I'm happy to chat about it.
Ok, then. 😄
I think the mongoose crud talk should include the reasons to favor save
, etc. See ga-wdi-boston/mongoose-crud#14
It seems that there is agreement not to make use findbyidandupdate
. Should we close?
I am okay with that. @jrhorn424 ❓
possible use for next time