Skip to content

Instantly share code, notes, and snippets.

View Smahrt's full-sized avatar

Kubiat Morgan Smahrt

View GitHub Profile
@Smahrt
Smahrt / How to quickly convert mongoose thenable query methods to use .exec().md
Created September 30, 2021 11:06
How to quickly convert mongoose thenable query methods to use .exec()
  • Using any IDE or Code Editor of your choice that supports RegExp for find/replace functions (e.g. VS Code)

  • Paste this in the Find field:

\.(find|findOne|deleteMany|deleteOne|findById|findByIdAndDelete|findByIdAndRemove|findByIdAndUpdate|findOneAndDelete|findOneAndRemove|findOneAndReplace|findOneAndUpdate|replaceOne|updateMany|updateOne)\((.*?)\)
  • Paste this in the replace field: