Skip to content
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

Async / Await Support #368

Closed
wants to merge 7 commits into from
Closed

Async / Await Support #368

wants to merge 7 commits into from

Conversation

countable
Copy link
Contributor

I made these changes to work with mongojs in codebases that are async/await heavy (like puppeteer tests). Eliminating callbacks also seems true to the original design statement of mongojs, to be as similar as possible to the mongodb repl. There's a reasonable amount of new test coverage and all old tests pass. However, I realize the code changes are substantial. I'm not certain if you (maintainers) want to include this feature in mongojs due to its large scope. If you do, please consider making a major version bump to alert users that some things may behave a little different.

At a minimum, the library will use a bit more memory due to creating Promise objects whenever an API is called without a callback in existing code, as this absence of a callback is what signals the creation of a Promise now. This should be harmless most of the time but it's hard to know how it might interact with what's out there. Cheers, and thanks for a great little mongodb lib over the years!

@saintedlama
Copy link
Collaborator

There are alternatives like mongoist out there that support async/await out of the box

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants