This repository has been archived by the owner on May 11, 2019. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.