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

mongo driver doesnt support contexts #1117

Closed
mfreeman451 opened this issue Oct 16, 2024 · 0 comments · May be fixed by #1118
Closed

mongo driver doesnt support contexts #1117

mfreeman451 opened this issue Oct 16, 2024 · 0 comments · May be fixed by #1118
Assignees
Labels

Comments

@mfreeman451
Copy link
Contributor

mfreeman451 commented Oct 16, 2024

Describe the bug

m, err := mongo.Connect(context.Background(), options.Client().ApplyURI(uri))
if err != nil {
	c.logger.Errorf("error connecting to mongoDB, err:%v", err)

	return
}

The context should be passed on here, there is no way to set a timeout or cancellation on this.

The Connect() interface should accept a context and return an error.

To Reproduce
Steps to reproduce the behavior, if applicable:

  1. The code is

  2. The error is

    
    

Expected behavior
Right now it will sit there and try and connect to a mongodb instance forever. users should have the ability to set a timeout context and properly return errors, instead of just printing stuff with the logger.

Screenshots
If applicable, add screenshots to help explain your problem.

Environments (please complete the following information):

  • OS: [e.g. Linux]
  • gofr version [e.g. v1.5.0]
  • go version [e.g. 1.21]

More description
Add any other context about the problem here.

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 a pull request may close this issue.

3 participants