Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Has the map/reduce interface changed in 0.10.2? #182

Open
joques opened this issue Aug 4, 2013 · 0 comments
Open

Has the map/reduce interface changed in 0.10.2? #182

joques opened this issue Aug 4, 2013 · 0 comments

Comments

@joques
Copy link

joques commented Aug 4, 2013

I am trying to fetch data from a bucket using a criterion, instead of a key. So I am using map/reduce. Suppose I have a bucket products and among other fields name. So I wanna fetch a product with a name provided by the user so I use the following code for my map/reduce


fetchFunction = (value, keyData, arg) =>
  curVal = Riak.mapValuesJson(value)[0]
  for criterionKey, criterionValue of arg
   if curVal[criterionKey] isnt criterionValue
     return {}
return curVal

then I call the actual map/reduce as follows:
dbClient.mapreduce.add(fullBucketName).map(fetchFunction, criteria).run((error, result) => callback error, result)
This code works fine in 0.9.3 but it fails in 0.10.2. It returns both the error and result objects an error with status 500
Has the interface to map/reduce changed in 0.10.2? Am I doing it wrong?
Any help?
José
PS: I know Riak.mapByFields does something similar, but I needed the key as well to subsequently manipulate the product object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant