Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-612

command helpers attach read preference incorrectly

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • legacy-1.0.2
    • Testing

    Description

      If the C++ driver wants to product a count or distinct command, with say, readPreference "secondary" - it will produce a command like this:

      {distinct: <collection name>, key: <keyname>, query: {filter: "myvalue", $readPreference: "secondary"}
      

      The correct form, according to the server selection spec, would be:

      {$query: {distinct: <collection name>. key: <keyname>, query: {filter: "myvalue"}, $readPreference: "secondary} 
      

      The server historically accepted the first due to relatively imprecise rules for parsing read preference. As all drivers now follow the server selection spec method for attaching RP, the C++ driver should do the same.

      This affects the helpers for count, distinct, mapreduce, and group.

      Attachments

        Activity

          People

            david.golden@mongodb.com David Golden
            adam.midvidy Adam Midvidy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: