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

Wait for client open, before calling db. #321

Merged
merged 1 commit into from Jun 15, 2019

Conversation

jaredhanson
Copy link
Contributor

The patch checks if the client is connected, and if not, registers an event listener for the open event. Once the event fires, the new connection proceeds as normal.

If a non-connected client is passed in currently, it will fail with the following error:

MongoError: MongoClient must be connected before calling MongoClient.prototype.db

This works with the native MongoDB driver, and follows a similar pattern to the existing handling of Mongoose connections.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 82.011% when pulling 07d0f15 on jaredhanson:client-on-open into 15d91c1 on jdesboeufs:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 82.011% when pulling 07d0f15 on jaredhanson:client-on-open into 15d91c1 on jdesboeufs:master.

@mingchuno mingchuno merged commit f29084f into jdesboeufs:master Jun 15, 2019
@stale
Copy link

stale bot commented Aug 14, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Aug 14, 2019
@Martii
Copy link

Martii commented Aug 16, 2019

Stale message but already merged... bad bot, bad bot! 😸

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

Successfully merging this pull request may close these issues.

None yet

4 participants