[CSHARP-1553] Returned value is partial by using map/reduce command Created: 02/Feb/16  Updated: 05/Apr/19  Resolved: 02/Feb/16

Status: Closed
Project: C# Driver
Component/s: API
Affects Version/s: 1.7.1
Fix Version/s: None

Type: Task Priority: Critical - P2
Reporter: Steven.Zhou [X] Assignee: Unassigned
Resolution: Done Votes: 0
Labels: question
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Os: windows7; The server version of mongodb is 3.0


Attachments: PNG File screenshot-1.png    

 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.



 Comments   
Comment by Craig Wilson [ 02/Feb/16 ]

Hi Steven,

We generally reserve tickets in Jira for bug reports or feature requests. A better place to ask questions is in our user group.

As this question also doesn't seem to pertain to the .NET driver at all, I'm going to close this ticket.

Craig

Comment by Steven.Zhou [X] [ 02/Feb/16 ]

When I do some debug, I found that the one element of emits 's "count" is bigger that "1". When mongodb is doing mapping, it also do reduce to combine the data?

Comment by Steven.Zhou [X] [ 02/Feb/16 ]

It looks like that before reducing, partial data has already been combined by mongodb? Whether mongodb has this feature?

Generated at Wed Feb 07 21:39:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.