Adding a record with a key but no bin does not seem to add the record


#1

Hi

My use case requires that I store Keys only. There is no need for the value. However, I don’t seem to be able to create a record without a bin.

The following will not throw an exception but will not insert the key neither

val key = new Key(params.namespace, "setVal", "keyVal")
client.add(params.writePolicy, key);

Is it expected?

Thank you for your help


#2

Hi

You cant store a key without a value, but you could store a Bin with a single character name a with a value of space

I hope this helps

Peter


#3

You should use the Put command which stores a record. The Add command is used for incrementing an integer value.