Moving from NodeJs from 0.12 to 8.9.3 - UDF issue

Hi Jan, This is what I see in the logs:

May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:1124] [key_from_jsobject] - key.ns = "cdbapplication"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:1136] [key_from_jsobject] - key.set = "profile"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:1149] [key_from_jsobject] - key.key = "manik"
May 11 2018 02:58:18 GMT: DEBUG(29362) [get_async.cc:61] [GetAsync] - Sending async get command

May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "manik"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname userhandle
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "Manik"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname name
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "manik"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "handle"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "manik-52f2067b-de27-4f11-a5af-e6ae64d6ea2c.jpeg"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "profilephoto"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = ""
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "about"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "manik-0942b849-b647-4e59-8811-58f1c655c641.jpeg"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "profilebannermedia"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 1455086846099
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "modifieddate"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "6"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "showcanvases"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "all"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "showgalleries"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "profilepage"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "preferences"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname staticdata
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 2
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname canvascnt
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 2
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname followercnt
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 2
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname followingcnt
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 0
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname gallerycnt
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 0
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname favoritecnt
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 10
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname postfavcnt
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 0
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname draftcnt
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "public"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname privacy
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname groups
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname interests
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 1
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "cpost"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 1
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "ufollow"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 1
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "pfav"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 1
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "cauthor"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 1
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "pcomment"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 1
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "cfollow"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 1
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "cfav"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 1
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "password"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 1
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "email"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 1
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "commentedOnPost"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "notification"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname settings
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 0
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname isSocial
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "yes"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname acknldg
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "1"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname tour
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "yes"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname acknldgintrst
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname profilefavlist
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 0
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname profilefavcnt
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = ""
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "contact"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = ""
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "twtr"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "INTG-08"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "INTG-10"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "INTG-11"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "interests"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = ""
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "address"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = ""
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "website"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = ""
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "fb"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = ""
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "description"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = ""
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "lnkdin"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = ""
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "instgrm"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname about
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 13
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname pageviewcnt
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:569] [val_to_jsvalue] - value = 6
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname postcnt
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:697] [recordmeta_to_jsobject] - TTL of the record -1
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:699] [recordmeta_to_jsobject] - Gen of the record 11
May 11 2018 02:58:18 GMT: DEBUG(29362) [async.cc:138] [async_record_listener] - Invoking JS callback function
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:1124] [key_from_jsobject] - key.ns = "cdbapplication"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:1136] [key_from_jsobject] - key.set = "userfollowing"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:1149] [key_from_jsobject] - key.key = "manik"
May 11 2018 02:58:18 GMT: DEBUG(29362) [get_async.cc:61] [GetAsync] - Sending async get command

May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:1124] [key_from_jsobject] - key.ns = "cdbapplication"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:1136] [key_from_jsobject] - key.set = "usercanvases"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:1149] [key_from_jsobject] - key.key = "manik"
May 11 2018 02:58:18 GMT: DEBUG(29362) [get_async.cc:61] [GetAsync] - Sending async get command

May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:1124] [key_from_jsobject] - key.ns = "cdbapplication"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:1136] [key_from_jsobject] - key.set = "userfavoriteposts"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:1149] [key_from_jsobject] - key.key = "manik"
May 11 2018 02:58:18 GMT: DEBUG(29362) [get_async.cc:61] [GetAsync] - Sending async get command

May 11 2018 02:58:18 GMT: TRACE(29362) [query.cc:52] [setup_query] - Number of filters in query: 1
May 11 2018 02:58:18 GMT: DEBUG(29362) [query.cc:65] [setup_query] - Building filter on predicate type 0, index type 0, data type 0, bin name 'requester'
May 11 2018 02:58:18 GMT: DEBUG(29362) [query.cc:113] [setup_query] - String equality predicate manik
May 11 2018 02:58:18 GMT: DEBUG(29362) [query_async.cc:66] [QueryAsync] - Sending async query command
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "kanvz"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "manik_mittal"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname userlist
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:697] [recordmeta_to_jsobject] - TTL of the record -1
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:699] [recordmeta_to_jsobject] - Gen of the record 1
May 11 2018 02:58:18 GMT: DEBUG(29362) [async.cc:138] [async_record_listener] - Invoking JS callback function
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "C_manik_1457090291779"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname ownedlist
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname authoredlist
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname followinglist
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname favoritelist
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname ownedpvt
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "C_manik_mittal_1439797310311"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname authoredpvt
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname draftlist
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname authoreddraft
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "C_manik_mittal_1439797310311"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname invitedlist
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:697] [recordmeta_to_jsobject] - TTL of the record -1
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:699] [recordmeta_to_jsobject] - Gen of the record 5
May 11 2018 02:58:18 GMT: DEBUG(29362) [async.cc:138] [async_record_listener] - Invoking JS callback function
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "P_kanvz_1457804545685"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "P_starthakur_1461067120179"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "P_manik_mittal_1485248012357"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "P_manik_mittal_1485178513075"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "P_manik_mittal_1485147954099"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "P_manik_mittal_1485147800409"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "P_manik_mittal_1484446050073"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "P_manik_mittal_1481959119277"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "P_manik_mittal_1481706857409"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:585] [val_to_jsvalue] - value = "P_manik_mittal_1481701325051"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:671] [recordbins_to_jsobject] - Setting binname postlist
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:697] [recordmeta_to_jsobject] - TTL of the record -1
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:699] [recordmeta_to_jsobject] - Gen of the record 9
May 11 2018 02:58:18 GMT: DEBUG(29362) [async.cc:138] [async_record_listener] - Invoking JS callback function
May 11 2018 02:58:18 GMT: DEBUG(29362) [async.cc:289] [async_scan_listener] - Invoking JS callback function
Inside queryUdf
statement.aggregationUDF.module:  canvassearch
statement.aggregationUDF.funcname:  search
statement.aggregationUDF.args:  [ 'jamroy', 'all', 'all' ]
May 11 2018 02:58:18 GMT: TRACE(29362) [query.cc:52] [setup_query] - Number of filters in query: 0
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:1381] [udfargs_from_jsobject] - Filename in the udf args is set to canvassearch
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:1400] [udfargs_from_jsobject] - The function name in the UDF args set to search
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:803] [list_from_jsarray] - Creating new as_arraylist with capacity 3
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:887] [asval_from_jsvalue] - type: 4, string value: "jamroy"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:887] [asval_from_jsvalue] - type: 4, string value: "all"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:887] [asval_from_jsvalue] - type: 4, string value: "all"
May 11 2018 02:58:18 GMT: TRACE(29362) [conversions.cc:1413] [udfargs_from_jsobject] - Parsing UDF args -- done !!!
May 11 2018 02:58:18 GMT: DEBUG(29362) [query_apply.cc:88] [execute] - Sending query command with stream UDF
May 11 2018 02:58:22 GMT: INFO (29362) [query_apply.cc:103] [respond] - Command failed: 100 UDF: Execution Error 1

May 11 2018 02:58:22 GMT: TRACE(29362) [query_apply.cc:111] [respond] - Invoking JS callback for query_apply
error:  { AerospikeError: UDF: Execution Error 1
    at Function.AerospikeError.fromASError (/mnt/canvas/app/releases/canvasproject/canvas.services/node_modules/aerospike/lib/error.js:133:12)
    at Command.convertError (/mnt/canvas/app/releases/canvasproject/canvas.services/node_modules/aerospike/lib/commands/command.js:42:27)
    at Command.convertResponse (/mnt/canvas/app/releases/canvasproject/canvas.services/node_modules/aerospike/lib/commands/command.js:50:22)
    at asCallback (/mnt/canvas/app/releases/canvasproject/canvas.services/node_modules/aerospike/lib/commands/command.js:102:22)
  message: 'UDF: Execution Error 1',
  code: 100,
  func: 'as_query_aggregate',
  file: 'src/main/aerospike/aerospike_query.c',
  line: 959 }

There are no log statements from the Aerospike C client library in your logs. Please make sure you use Aerospike.setDefaultLogging() to enable logging. If you just set the log level while initialising a new client instance (e.g. Aerospike.connect({log: {level: ...}})), that does not enable logging for the C client library.

I tried using the Aerospike.setDefaultLogging(), but it gave error that this method is not available.

Ah, sorry, I forgot that you are on client version 3.0.2. This method was introduced in v3.1.0. Would it be possible for you to upgrade to the latest client version?

Sorry for the verrrrrry long delay Jan.

I tried that example, but looks like it returns back a single record only. Is there a way like forEach, which I can use to get an array of records?

Regards, Manik

Hi @Jan

I also tried the old way of accessing the UDF, the way we were accessing the UDF earlier.

 var statement = {aggregationUdf:{module: 'canvassearch', func: 'search', args:['node', 'canvas', 'all']}};
console.log("statement: ",statement);
var qry = client.query(dbName, setName, statement);
var stream = qry.execute();

I am getting the following error:

TypeError: qry.execute is not a function
    at Aerospike.queryUdf (/mnt/canvasproject/canvas.services/modules/aerospike/aerospike.js:187:22)
    at Schema.queryUdf (/mnt/canvasproject/canvas.services/modules/aerospike/schema.js:231:22)
    at Schema.tryCatcher (/mnt/canvasproject/canvas.services/node_modules/bluebird/js/main/util.js:26:23)
    at Schema.ret [as queryUdfAsync] (eval at makeNodePromisifiedEval (/mnt/canvasproject/canvas.services/node_modules/bluebird/js/main/promisify.js:163:12),<anonymous>:13:39)
    at /mnt/canvasproject/canvas.services/api/search/search.controller.js:303:23
    at tryCatcher (/mnt/canvasproject/canvas.services/node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (/mnt/canvasproject/canvas.services/node_modules/bluebird/js/main/promise.js:510:31)
    at Promise._settlePromiseAt (/mnt/canvasproject/canvas.services/node_modules/bluebird/js/main/promise.js:584:18)
    at Async._drainQueue (/mnt/canvasproject/canvas.services/node_modules/bluebird/js/main/async.js:128:12)
    at Async._drainQueues (/mnt/canvasproject/canvas.services/node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/mnt/canvasproject/canvas.services/node_modules/bluebird/js/main/async.js:15:14)
    at processImmediate (internal/timers.js:443:21)
    at process.topLevelDomainCallback (domain.js:136:23)

Thanks and Regards,

Manik Mittal

Basic feature of the UDF is to search a bunch of records on the basis of some criteria.

Have you taken a look at the new Aerospike Expressions API: https://www.aerospike.com/docs/guide/expressions/?

(Or if you are not on Aerospike 5.2 or later, you could consider using Predicate Expressions instead: https://www.aerospike.com/docs/guide/predicate.html.)

Thanks Jan for your response and help.

We are using Aerospike Server version 4.8.0.2

asinfo -v build 4.8.0.2

and Aerospike Nodejs Client version: 3.13.0

That’s great. Then check out the Node.js client’s predexp module to see how you can search your data using Aerospike’s predicate expressions.

For example, using predexp it’s possible to combine multiple filter conditions using logical operators:

const Aerospike = require('aerospike')
const predexp = Aerospike.predexp

const query = client.query('test', 'demo')
// find records where 21 <= age <= 45
query.where([
  predexp.integerBin('age'),
  predexp.integerValue(21),
  predexp.integerGreaterEq(),
  predexp.integerBin('age'),
  predexp.integerValue(45),
  predexp.integerLessEq(),
  predexp.and(2)
])
const stream = query.foreach()

Predexp also support filtering based on values stored in complex data types, i.e. lists, maps, or GeoJSON values, as well as record metadata, i.e. last update time.

Please refer to the Predicate Filtering guide as well as the client’s API docs for more information.

Thanks @Jan,

So, does this mean that we can’t execute our old UDF, the way we were using earlier. We have putted up a map reduce based function in our UDF. Are you suggesting to move that into NodeJS logic using predicate?

Thanks, Manik Mittal

Hi @manikmi,

You can continue to use your existing UDFs.

UDFs are still supported. But many types of queries that required UDFs before, can now be solved with the new Aerospike Expressions (or Predicate Expressions for v5.1 and earlier) much more efficiently.

Hope this helps, Jan

Thanks @Jan, The UDF is working fine on AQL console, but it is not working with the nodejs client. As i mentioned above here: Moving from NodeJs from 0.12 to 8.9.3 - UDF issue - #26 by manikmi I am not able to use the UDF with nodejs client

The Query#execute function was deprecated in v2 of the Aerospike Node.js client, and was removed entirely in v3. To aggregate query results using UDF you have to use the Query#apply function. You can see a few simple examples in the client’s test suite.