How to add a bin with value to existing key

Hi

Is there a way to add a (bin, value) to existing key in atomic way.

For example there is a key with data

'bin1': 'value1'

and by doing something similar to client.add_bin(key, ‘bin2’, ‘value2’) get

'bin1': 'value1'
'bin2': 'value2'

without reading all the key record and putting back with updated bin info.

I saw that Aersopike client does have “remove_bin” function, I wondering will it have add_bin?

Thanks.

You have described the default behavior. The only time the existing record isn’t merged with the new write is when the write policy is set to replace.

I saw that Aersopike client does have “remove_bin” function, I wondering will it have add_bin?

This is done by sending a NULL value for the bin.

A bin is added automatically when you write a bin-name/bin-value pair that doesn’t yet exist. Removing it is done via sending a null, or in the case of the ‘bin remove’ that’s a helper that sends the null for you.

A post was split to a new topic: How do I add a bin to a set with a default value?

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