How to return record passed into Lua


#1

Hi guys,

Hope you can help me out. Am very new to both Aerospike and Lua. I am on NodeJS client. For the past few hours, I have been trying to print to screen the record passed to Lua.

hello.lua

function hello(rec) return rec end I’ve inserted a record into the database. And I executed the record UDF as follows.

rec is a simple { abc: “def” } object

execute.js

var key= aerospike.key(“test”, “what”, “foo”); var udf= { module: ‘hello’, funcname: ‘hello’ } client.execute(key, udf, function(error, res, key) { if(error.code!= aerospike.status.AEROSPIKE_OK) { console.log(“error : %s”, error.message); } console.log(res); });


#2

Hi Zhongcai,

Have you had a chance to check out any of the examples on our Github Node.js example directory?

If doing so does not answer your question, or if you have follow-up questions, kindly let us know.