Mongodb Mapreduce giving an error?

Seems like you just need to use count. Map Function: function () { emit(this. Clientid, {count:1}); } Reduce Function: function (key, vals) { var result = {count:0}; vals.

ForEach(function (value) {result. Count += value. Count;}); return result; }.

I know they have the same value for now.. I have other plans for it later :) – Wael Awada Apr 6 at 19:57 Okay, well you can just add it to the form I've provided above. Your map function is in completely the wrong format, as clientID is not actually a property of formData, and then in addition to this forEach can't be used to iterate over object properties. – schizodactyl Apr 6 at 20:00 ok assuming we remove the client id, what is the right method to iterate over the properties of the contents of FormData – Wael Awada Apr 6 at 20:01 I'm not 100% certain what you're trying to do, but my best guess is that you want to still group by this.

ClientID, but then have an emit() for each element in form data. So have a loop like for (val in this. FormData) { emit(this.

ClientID, {count: 1, datalength: val. Length}) } . – schizodactyl Apr 6 at 20:06 as a function that worked.. – Wael Awada Apr 6 at 21:06.

ForEach() is a method of Array, not any arbitrary object literal. You cannot use it to iterate over object properties.

Thanks for the reply, I am new to Mongo..This was from a java object.. pretty much a clientId and a Map fields.. What is the right method to iterate a "Map"(?) inside mongodb.. – Wael Awada Apr 6 at 19:46.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions