Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1553

Returned value is partial by using map/reduce command

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Critical - P2 Critical - P2
    • None
    • 1.7.1
    • API
    • Os: windows7; The server version of mongodb is 3.0

    Description

      I get partial data from mongodb by using map/reduce api as well as by running the command in client tool. The command is like as below.
      var m = function ()
      {
      emit(this.FundCode,

      { count : 1,itemCollection:[], CustomerNo : this.CustomerNo, FundCode : this.FundCode , NaturalDate : this.NaturalDate, ShareVal : this.ShareVal, CostValue : this.CostValue, CurUnpaidValue : this.CurUnpaidValue, UnpaidValue : this.UnpaidValue, ProfitValue : this.ProfitValue, ProfitValue2 : this.ProfitValue2, FloatProfitRate : this.FloatProfitRate, UpdateTime : this.UpdateTime }

      );
      };
      var r = function (key, emits)
      {
      var total =0;var items =[];

      for (var i in emits)
      {
      total += emits[i].count;
      items.push(

      {UnpaidValue : emits[i].UnpaidValue}

      );
      }

      return

      {count : total, itemCollection: items }

      ;
      };

      db.runCommand(
      { "mapreduce" : "ProfitEntity",
      "map" : m,
      "reduce": r,
      "out" :

      { "inline" : 1 }

      })

      In theory, "count" equals the length of itemCollection. But it doesn't. The length of itemCollection is less. It is very strange. I have tested it by small data. The result is right. But by using big data it is wrong.

      Attachments

        Activity

          People

            Unassigned Unassigned
            Steve Steven.Zhou [X]
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: