How to delete a single bin from set?


#1

Hello

I’m using python client,i want to delete a single bin from my set,please provide solution.

ThanksScreenshot from 2017-08-23 17-21-02

In this records i want to delete ‘level’ bin from set


#2

In the Python client you assign the bin you want to delete (in this case ‘level’) with the value aerospike.null().

However, if every record in a set has a bin you want to remove, it would be more efficient to remove the record using a record UDF that assigns the Lua value nil to this bin. You would then apply the function to each record in the set, for example from AQL.

fix.lua

function del_level(rec)
  rec['level'] = nil
  aerospike:update(rec)
end

In AQL:

$ aql
Aerospike Query Client
Version 3.12.0
C Client Version 4.1.4
Copyright 2012-2017 Aerospike. All rights reserved.
aql> register module './fix.lua'
OK, 1 module added.

aql> execute fix.del_level() on test.foo