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

Add Read Preference and Tags to Mongo config #53

Closed
danny-cassidy opened this issue Apr 28, 2016 · 4 comments
Closed

Add Read Preference and Tags to Mongo config #53

danny-cassidy opened this issue Apr 28, 2016 · 4 comments

Comments

@danny-cassidy
Copy link

danny-cassidy commented Apr 28, 2016

Rather than rely on a MasterHost config value, which can change during elections, it would be more flexible to use Mongo's built in support for read preference and tags to constrain which nodes in the Hosts field can be used.

If these configurations are set, the MongoDB object can supply these to the mgo Session object before returning it to the client via:

https://godoc.org/gopkg.in/mgo.v2#Session.SetMode (Read Preference)
https://godoc.org/gopkg.in/mgo.v2#Session.SelectServers (Tags)

@jprobinson
Copy link
Contributor

Sounds like a good idea. I usually end up calling SetMode right after calling Gizmo's config.MongoDB.Must() anyways.

@danny-cassidy do you want to take a whack at adding these for your first Gizmo PR? If not, I can find some time to do this in the next day or two.

@danny-cassidy
Copy link
Author

Yeah, I'd love to submit a PR for this. 👍

@jprobinson
Copy link
Contributor

👍 Looking forward to it!

danny-cassidy added a commit to danny-cassidy/gizmo that referenced this issue May 2, 2016
Rename method names

Check lowercase version of mgo Session mode config value
jprobinson pushed a commit that referenced this issue May 2, 2016
Rename method names

Check lowercase version of mgo Session mode config value
@jprobinson
Copy link
Contributor

This was resolved in PR #54

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

No branches or pull requests

2 participants