Skip to content

Commit 022bc04

Browse files
committed
client: apply read preference tags from mongoc_uri_t.
1 parent 513b8a7 commit 022bc04

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/mongoc/mongoc-client.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@ mongoc_client_new (const char *uri_string)
669669
{
670670
const mongoc_write_concern_t *write_concern;
671671
mongoc_client_t *client;
672+
const bson_t *read_prefs_tags;
672673
mongoc_uri_t *uri;
673674
const bson_t *options;
674675
bson_iter_t iter;
@@ -712,6 +713,11 @@ mongoc_client_new (const char *uri_string)
712713
client->read_prefs = mongoc_read_prefs_new (MONGOC_READ_PRIMARY);
713714
}
714715

716+
read_prefs_tags = mongoc_uri_get_read_prefs (client->uri);
717+
if (!bson_empty (read_prefs_tags)) {
718+
mongoc_read_prefs_set_tags (client->read_prefs, read_prefs_tags);
719+
}
720+
715721
_mongoc_cluster_init (&client->cluster, client->uri, client);
716722

717723
#ifdef MONGOC_ENABLE_SSL

0 commit comments

Comments
 (0)