I try to register this module to create a largeMap. The code is the following :
local lmap = require(‘ldt/lib_lmap’);
function create_existence_record_simplified(rec, binName, keyMap, newValue)
if aerospike:exists(rec) then
lmap.put(rec, binName, keyMap, newValue);
return rec;
else
lmap.put(rec, binName, keyMap, newValue);
return rec;
end
end
in a file named functions.lua
In node .js I can’t register the module → i had {“code”:100,“message”:“UDF: Execution Error 1”,“func”:“as_command_parse_udf_error”,“file”:“src/main/aerospike/as_command.c”,“line”:731}
I then try to register via aql which worked and then to call the function in my node script:
var usersCreate = aerospike.key(aerospikeDBParams.defaultNamespace,aerospikeDBParams.defaultSet,‘users’);
var udf = { module:‘functions.lua’, funcname: ‘create_existence_record_simplified’, args: [‘lmapUsers’,idInDb, defaultUser]};
client.execute(usersCreate, udf, function(err, result) {
if ( err.code !== aerospike.status.AEROSPIKE_OK ) {
sails.log(JSON.stringify(err));
}
});
I have the same error that wwhen I try to register the module
I want to get a large map named “lmapUsers” with for each key the id of an userwhen he as registered and for the value some basics infos such as (when I make a console.log on defaultUser) :
{ username: ‘bbb’, email: ‘bb@bb.fr’, privacy: ‘public’, reportConfidence: 1 }