[CDRIVER-645] Support setting "uri options" explicitly Created: 12/May/15 Updated: 17/Aug/15 Resolved: 13/Jul/15 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libmongoc |
| Affects Version/s: | 1.2.0 |
| Fix Version/s: | 1.2-beta0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Hannes Magnusson | Assignee: | Hannes Magnusson |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
Currently the only way to set many of the options is via long, tedious and annoying URI. This includes credentials, timeout options and ssl. It would be nice to be able to set these explicitly via mongoc_client_set_read_pref() and so on |
| Comments |
| Comment by Githook User [ 13/Jul/15 ] | |||||||||||||||||||||||
|
Author: {u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}Message: | |||||||||||||||||||||||
| Comment by Githook User [ 13/Jul/15 ] | |||||||||||||||||||||||
|
Author: {u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}Message: Previously the code over-complicated things by reconstructing the uri by This also removes the now useless _mongoc_client_new () | |||||||||||||||||||||||
| Comment by Hannes Magnusson [ 09/Jul/15 ] | |||||||||||||||||||||||
|
I don't think 'w' should be in the int32 options. As for mongoc_client_new_from_uri (..), I hadn't considered that this could be used as a "URI builder". I think the best fix for that is to adapt mongoc_uri_get_string () to return the "compiled uri". Sounds like a plan? | |||||||||||||||||||||||
| Comment by A. Jesse Jiryu Davis [ 09/Jul/15 ] | |||||||||||||||||||||||
|
Let's add "w" to the list of int32 options. Additionally this fails:
... because mongoc_client_new_from_uri doesn't actually use the parsed options in the uri. It just passes uri->str to mongoc_client_new, which parses the uri again! And forgets the options we overwrote in the original uri. We need to swap the relationship: mongoc_client_new (const char *) should make a URI and call mongoc_client_new_from_uri (mongoc_uri_t *), instead of the opposite relationship, which is what we have now. | |||||||||||||||||||||||
| Comment by Githook User [ 07/Jul/15 ] | |||||||||||||||||||||||
|
Author: {u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}Message: Simplifies and consistentifies fetching uri options Created & added -private API for:
Updated the existing URI accessing code to use the new functions rather then Only expose this to internal API (e.g. wrapping libs/drivers) as this Also added mongoc_uri_append_host() to the -private API. | |||||||||||||||||||||||
| Comment by Hannes Magnusson [ 11/Jun/15 ] | |||||||||||||||||||||||