#StackBounty: #mongodb #mongoose Get stack trace from errors using mongoose without calling .exec()?

Bounty: 150

I recently read in the mongoose docs that to get a stack trace from mongoose errors that includes details about which file the mongoose code was called from, you need to call .exec()?

Example:

I currently have a lot of code using this structure:

await collection.deleteMany({});

Do I need to add .exec() to get a more helpful stack trace?

await collection.deleteMany({}).exec();

If so, is there a global workaround, so I don’t have to add .exec() a countless number of times?

References:

https://mongoosejs.com/docs/promises.html#should-you-use-exec-with-await
https://github.com/Automattic/mongoose/issues/8747


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.