Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1082

Don't allow TagSets to be used with a ReadPreferenceMode of Primary

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.10, 2.0
    • Affects Version/s: 1.9.2
    • Component/s: Configuration
    • None
    • Minor Change

      When the ReadPreferenceMode is Primary it is not valid to supply tag sets, but the driver currently doesn't enforce that. There are multiple ways that such an invalid read preference might come to exist.

      One example is:

      var tagSets = new [] { new ReplicaSetTagSet { new ReplicaSetTag("dc", "ny") } };
      var readPreference = new ReadPreference(ReadPreferenceMode.Primary, tagSets);
      

      Another example is:

      var builder = new MongoUrlBuilder("mongodb://localhost/?readPreference=primary;readpreferencetags=dc:ny");
      var url = builder.ToMongoUrl();
      

      There might be other ways.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: