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

mapReduce return incorrect result

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical - P2 Critical - P2
    • None
    • 3.2.1
    • MapReduce
    • None
    • ALL

    Description

      I have the following code (in ruby using mongoid)

      map = %Q{
            function() {      
                emit(1000, {count: this.am});
            }
          }
       
            reduce = %Q{
            function(key, values) {
       
              var count = 0;
              values.forEach(function(value) {
                count++;
              });
       
              return { count: count};
            }
          }
      

      Problem is, that count == 2. while I have a couple of hundreds of documents

      Attachments

        Activity

          People

            kelsey.schubert@mongodb.com Kelsey Schubert
            odedshafran Oded Shafran
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: