-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
None
-
Not Needed
Summary
Per docs (https://docs.mongodb.com/manual/core/read-preference-tags), an empty tag can be used as a "fail-safe" mechanism to connect to any node regardless of tag:
"To avoid an error if no members match any of the tag specifications, you can add an empty document {{{ }}} as the last element of the tag set to read from any eligible member."
However, when using "readPreferenceTag=" as the last tag set in the connection URI the driver fails to send an empty document in the tag array. I found a commit (https://github.com/mongodb/mongo-go-driver/commit/bfd961abf162856d6dc7c6d97ec627c18e1ceed0) that seems to simply break instead of treating as an empty document.
How to Reproduce
- Standup replica set and provide any tag (ex: {dc: dev} )
- Try to connect with URI containing mismatched tag, but with empty tag as a "fail-safe" (ex: ?readPreferenceTag=dc:prod&readPreferenceTag=)
- Connection will fail
- is related to
-
GODRIVER-2205 Empty read preference tag sets are incorrectly skipped during command construction
- Closed