Apply lean({virtuals: true}.exec() to all applicable mongoose calls by default

Viewed 139

Is there is a sane way to patch mongoose to treat all calls like Model.findById() and Model.find() as Model.findById().lean({virtuals: true}).exec() and Model.find().lean({virtuals: true}).exec().

I found an example of monkey patching to apply lean by default, but it doesn't solve the problem above.

0 Answers
Related