Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-7789

mapReduce on a sharded collection fails with $readPreference

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.2.2
    • Component/s: Sharding
    • Labels:
      None
    • ALL
    • Hide

      First, shard the collection that you're map/reducing over.
      Then, run a command like:

      mongos> db.runCommand( { "mapreduce" : "test", map : "function() {}", reduce : "function() {}", out :

      {inline:1}

      , "$readPreference" :

      { mode : "primary"}

      } )

      { "ok" : 0, "errmsg" : "unknown m/r field for sharding: $readPreference" }
      Show
      First, shard the collection that you're map/reducing over. Then, run a command like: mongos> db.runCommand( { "mapreduce" : "test", map : "function() {}", reduce : "function() {}", out : {inline:1} , "$readPreference" : { mode : "primary"} } ) { "ok" : 0, "errmsg" : "unknown m/r field for sharding: $readPreference" }

      Running a mapReduce against mongos on a sharded collection with a driver that supports $readPreference produces a server error:

      { "serverUsed" : "localhost/127.0.0.1:30999" , "ok" : 0.0 , "errmsg" : "unknown m/r field for sharding: $readPreference"}

            Assignee:
            randolph@mongodb.com Randolph Tan
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: