-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
I have a config string 'mongodb://mongodb01.test.vpc,mongodb02.test.vpc,mongodb03.test.vpc/prod?readPreference=secondaryPreferred'
it was parsed to dict below by pymongo.uri_parser.parse_uri
{'collection': None,
'database': 'prod',
'nodelist': [('mongodb01.test.vpc', 27017),
('mongodb02.test.vpc', 27017),
('mongodb03.test.vpc', 27017)],
'options': {'readpreference': 'secondaryPreferred'},
'password': None,
'username': None}
but mongoengine only read in 3 params if I read correctly, ignored 'readpreference'
if 'replicaset' in uri_options:
conn_settings['replicaSet'] = uri_options['replicaset']
if 'authsource' in uri_options:
conn_settings['authentication_source'] = uri_options['authsource']
if 'authmechanism' in uri_options:
conn_settings['authentication_mechanism'] = uri_options['authmechanism']
thus made my config not functioning as I needed.
I don't know if this is a bug or a feature. To achieve my goal do I have to explicitly invoke connect(..., read_preference=secondaryPreferred)? Isn't controlling readpreference in a config string be more flexible?
Metadata
Metadata
Assignees
Labels
No labels