I think the title concisely describes what I’m looking for but I’ll also give some pseudocode and make sure this is actually a problem.
So I want to do this
aerospike.operate( key, [ remove_from_list_bin(...), if_list_empty_after_removal_remove_list_bin(...) ] )
but I don’t believe there’s a way to check for emptiness after an operation?
Now I could do this
try: aerospike.operate( key, [ remove_from_list_bin(...), remove_list_bin(...) ], expressions=[if removing from list bin results in emtpy list then True] ) except FilteredOut: aerospike.remove_from_list_bin(...)
or (better) just this
aerospike.remove_from_list_bin(...) aerospike.remove_list_bin(expressions=[if list bin is empty then True])
but I want to avoid the multiple calls without using a UDF, for lists and maps.
Am I missing something? Is there already a better way to do this in a single transaction (again, without a UDF)? Is mixing expressions into operations already possible or is this a feature that’s come up before?