Skip to content

Promisify all mongoose queries using async/await #521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
catarak opened this issue Feb 7, 2018 · 16 comments
Open
1 task done

Promisify all mongoose queries using async/await #521

catarak opened this issue Feb 7, 2018 · 16 comments
Assignees
Labels
Area:Optimization Category for site performance optimization and management Help Wanted Would love additional input or contributions! Priority:Medium Moderately important, should be completed in a fair timeframe Ready for Work Issue is ready for development work Type:Task Tasks tied specifically to developer operations and maintenance

Comments

@catarak
Copy link
Member

catarak commented Feb 7, 2018

Nature of issue?

  • Existing feature enhancement

Feature enhancement details:

Right now, all of the mongoose queries use callbacks instead of the new ES6 promise syntax. This should be updated as nested callbacks are difficult to read.

@catarak catarak added Help Wanted Would love additional input or contributions! Type:Task Tasks tied specifically to developer operations and maintenance Priority:Medium Moderately important, should be completed in a fair timeframe Good First Issue A beginner-friendly issue, great for first-time contributors labels Feb 7, 2018
@dhruvdutt
Copy link
Contributor

I'm on it.

@himanshuc3
Copy link
Contributor

@dhruvdutt still on it?

@dhruvdutt
Copy link
Contributor

Yeah. I've already started with it. Will be pushing by this week.

@migom6
Copy link
Contributor

migom6 commented Mar 20, 2018

is anyone assigned to this issue?

@catarak
Copy link
Member Author

catarak commented Mar 20, 2018

@dhruvdutt started working on it but i don't know how far they got. feel free to start on this!

@catarak
Copy link
Member Author

catarak commented Mar 20, 2018

it might be helpful to work on this in pieces, like promisify one controller at a time or something.

@dhruvdutt
Copy link
Contributor

Ah! I'm sorry, couldn't get back to this. I would be happy to review a PR.
Best of luck @migom6 👍

@siddhant1
Copy link
Contributor

Working!

@catarak
Copy link
Member Author

catarak commented Mar 20, 2019

this is a big issue, so i recommend making small PR's!

@shakeabi
Copy link

@catarak As the task is huge, I too would like to contribute to this.

@meiamsome
Copy link
Member

Are we prefer the promise .then chains, or should the code be using async/await? I would prefer the latter for readability

@catarak
Copy link
Member Author

catarak commented Mar 21, 2019

i definitely prefer async / await! i'll update the issue title.

@catarak catarak changed the title Promisify all mongoose queries Promisify all mongoose queries using async/await Mar 21, 2019
@siddhant1
Copy link
Contributor

We have to change the error handling mechanics with async/await , I have some links , I will post them here

@catarak
Copy link
Member Author

catarak commented Feb 4, 2020

There's an in-depth conversation about some of the struggles of using async-await with Express: #973

TL;DR It makes sense to include an async middleware like express-async-handler, or update to a different Node framework, like Fastify or Koa.

@catarak catarak removed the Good First Issue A beginner-friendly issue, great for first-time contributors label Feb 12, 2020
@kjhollen kjhollen added the Area:Optimization Category for site performance optimization and management label Nov 12, 2021
@raclim raclim added the Ready for Work Issue is ready for development work label May 13, 2025
@yugalkaushik
Copy link
Contributor

@raclim Can I work on this issue?

@raclim
Copy link
Collaborator

raclim commented May 27, 2025

@yugalkaushik feel free to give it a go! I'd echo an earlier comment on breaking this down into smaller PRs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:Optimization Category for site performance optimization and management Help Wanted Would love additional input or contributions! Priority:Medium Moderately important, should be completed in a fair timeframe Ready for Work Issue is ready for development work Type:Task Tasks tied specifically to developer operations and maintenance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants