mapReduce return incorrect result

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Critical - P2
    • None
    • Affects Version/s: 3.2.1
    • Component/s: MapReduce
    • None
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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

            Assignee:
            Kelsey Schubert
            Reporter:
            Oded Shafran
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: