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

mapReduce with 'reduce' output action fails with an massert on output collection with no _id index

    • Query
    • ALL
    • Hide
      (function() {
          'use strict';
      
          var source = db.mr_source;
          var out = db.mr_out;
      
          source.drop();
          out.drop();
      
          // create a dummy collection for mapReduce input
          source.insert({a: 1});
      
          // create a collection with no _id index and insert a document
          db.createCollection(out.getName(), {autoIndexId: false});
          out.insert({_id: 0});
      
          var mapper  = function() {emit(1, 1);};
          var reducer = function() {return 1;};
      
          // the mapReduce will fail because of the missing _id index
          source.mapReduce(mapper, reducer, {out: {reduce: out.getName()}});
      }());
      
      Show
      (function() { 'use strict'; var source = db.mr_source; var out = db.mr_out; source.drop(); out.drop(); // create a dummy collection for mapReduce input source.insert({a: 1}); // create a collection with no _id index and insert a document db.createCollection(out.getName(), {autoIndexId: false}); out.insert({_id: 0}); var mapper = function() {emit(1, 1);}; var reducer = function() {return 1;}; // the mapReduce will fail because of the missing _id index source.mapReduce(mapper, reducer, {out: {reduce: out.getName()}}); }());
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      A mapReduce command that specifies a 'reduce' output action against a collection without an _id index will fail with an massert.

      The root cause is a Helpers::findOne call that requires the use of an index: https://github.com/mongodb/mongo/blob/r3.0.0-rc8/src/mongo/db/commands/mr.cpp#L644-L648


      Error message:

      Assertion: 17245:Could not get executor for query { _id: 1.0 }
      

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            kamran.khan Kamran K. (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: