Skip to content
This repository has been archived by the owner on May 11, 2019. It is now read-only.

Added a few things to mongogo. #4

Closed
wants to merge 9 commits into from
Closed

Added a few things to mongogo. #4

wants to merge 9 commits into from

Conversation

sbunce
Copy link

@sbunce sbunce commented Dec 29, 2010

I added a "FindOneFields" function.

Also, I added a ConnError type and wrapped all connection related errors in it. I was having the problem where I couldn't determine if an error was a connection related error, or other type of error. So as a result I was just reconnecting whenever I got an error. I added in the ConnError type so I could do:

if err, ok := err.(*mongo.ConnError); ok {
//reconnect
}

Lastly I added a unit test (which currently only covers FindOneField). I consider having a test to be questionable because it requires a mongo database running on localhost. I'm not sure if you'll want to merge this or not.

I messed up a bit on my commits. I made a bunch of small commits. When I tried to squash them together it didn't remove the others. I'm new to Git and distributed version control in general.

@edsrzf
Copy link
Owner

edsrzf commented Dec 29, 2010

Thanks for adding this. A few comments inline.

Also, I think I'll hold off on the test. I do really want some tests, but I'm just not sure what the best way is to add them. I may end up doing something like what you've done. It looks like that's what other drivers are doing. I'm not really that comfortable with it, but I don't see a better way without implementing my own mock server or something like that.

If you need help making the changes, just ask. Or if you just want me to do it, that's fine too.

This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants