As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
mapReduce within the custom end point started failing with mongoDB internal error
P
Pankaj Chawla
started a topic
almost 10 years ago
So we have a custom end point that does a mapReduce call and has been working for sometime. I checked today and its failing with a mongoDB internal error. If I pass any variable through scope to the mapReduce function, its doesnt get visible in the mapper function and hence the error. Below is a stripped down code sample to show the problem.
var mapFnV2 = function(){
........
var foo = test; // THIS IS THE ERROR LINE. VAR test IS NOT VISIBLE.
"mapreduce failed: {\"code\":\"MongoError\",\"message\":\"An error has occurred within MongoDB while trying to execute your query\",\"mongoErrorCode\":16722,\"mongoErrorMessage\":\"exception: ReferenceError: test is not defined near 'var foo = test;
1 Comment
M
Michael
said
almost 10 years ago
Hello,
This was due to a software bug that has now been resolved. We apologize for the inconvenience.
Pankaj Chawla
var mapFnV2 = function(){
........
var foo = test; // THIS IS THE ERROR LINE. VAR test IS NOT VISIBLE.
........
emit(strDt, {"data" : value});
};
var reduceFnV2 = function(k, v) {
var reduced = {"data":[]};
......
return reduced;
};
modules.collectionAccess.collection(collectionName)
.mapReduce(mapFnV2,
reduceFnV2,
{ out: {inline:1},
scope: { test: "pankaj"},
query: queryStr,
},
function(err, collection) {
if (err) {
modules.logger.error("mapreduce failed: " + JSON.stringify(err));
return response.error(400);
}
else {
response.body = collection;
return response.complete(200);
}
});
"mapreduce failed: {\"code\":\"MongoError\",\"message\":\"An error has occurred within MongoDB while trying to execute your query\",\"mongoErrorCode\":16722,\"mongoErrorMessage\":\"exception: ReferenceError: test is not defined near 'var foo = test;