You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
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.
The text was updated successfully, but these errors were encountered: