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

XMLWordPrintableJSON

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

      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 Stam
              Reporter:
              Rod Adams (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: