This fixes 2 problems I've encountered when working with sharded mongodb cluster:
GetShards function always returned empty results, because a filter query was incorrect (it used nil as a filter instead of bson.D{})
If there are multiple comma-separated hostnames for different mongodb replicas in each shard, the GetUrl function returned invalid URLs. Now it returns a first URL from the comma-separated list, which is imperfect, but at least it works.
This fixes 2 problems I've encountered when working with sharded mongodb cluster:
GetShards
function always returned empty results, because a filter query was incorrect (it usednil
as a filter instead ofbson.D{}
)GetUrl
function returned invalid URLs. Now it returns a first URL from the comma-separated list, which is imperfect, but at least it works.