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

ReadPreference and MaxTime not honored for cursor.Count() and Size()

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.10, 2.0
    • Affects Version/s: 1.9.2
    • Component/s: Operations

      C# Driver: 1.9.2
      MongoDB: 2.6.5
      Sharded Cluster w/ Replicas

      var cursor = m_RecipientCollection.FindAs<BsonDocument>(q)
                                  .SetFields(fields)
                                  .SetSkip(offset)
                                  .SetLimit(limit)
                                  .SetSortOrder(SortBy.Descending(UserAttrId.Timestamp))
                                  .SetReadPreference(ReadPreference.SecondaryPreferred);
                      total = cursor.Count();
      

      The above specifies a Read Preference of Secondary Preferred, yet the count command is sent to the primary, even when there's a perfectly responsive Secondary about, as proven by iterating cursor built the same way running against the secondary.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            rod.adams@mongodb.com Rod Adams
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: