Properly store record key and metadata in a mapped stream UDF

Hello! I’m writing a UDF that will return a filtered list of records. So far my UDF looks like this:

local function filterCounter(count)
    return function(rec)
        if rec['count'] >= count then
            return true
            return false

local function mapRecord(rec)
    local result = map()
    result['key'] = record.key(rec)
    result['count'] = rec['count']
    result['ttl'] = record.ttl(rec)
    return result

function findByCounter(stream, count)
    local myfilter = filterCounter(count)
    return stream : filter(myfilter) : map(mapRecord)

But when I do a console.log from the node.js client, each record will look like this:

Record {
  key: null,
  bins: { key: '5', count:2, ttl: 10 },
  ttl: undefined,
  gen: undefined }

My question is, how can I store the relevant info from the record in the key, and ttl properties of the map object and not inisde the bins property? Thanks!

All data is handled inside bins, except for metadata like key/lut/ttl/gen/etc. Why is this problematic? What problem are you trying to solve?

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.

© 2015 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.