If the column_2 is a String column the result is the following exception:
com.aerospike.client.AerospikeException: Error Code 12: Bin type error
at com.aerospike.client.command.WriteCommand.parseResult(WriteCommand.java:59)
at com.aerospike.client.command.SyncCommand.execute(SyncCommand.java:56)
at com.aerospike.client.AerospikeClient.add(AerospikeClient.java:360).
The first time I invoke:
aerospikeClient.add(writePolicy, key, bins);
With this parameters:
writePolicy → writePolicy.recordExistsAction = RecordExistsAction.UPDATE;
key → new Key(“catalog_functional_test”, assimpleinserttest, “1”)
bins–> [column_2:6]
The second time I invoke the same api method with this parameters:
writePolicy → writePolicy.recordExistsAction = RecordExistsAction.UPDATE;
key → new Key(“catalog_functional_test”, assimpleinserttest, “1”)
bins–> [column_2:8]
The “add” operation increments or decrements an Integer Bin value by the amount that you pass as a parameter.
Assuming that the initial value is zero, after your firs invocation, the value of the Bin would be 6 (0 + 6 = 6). After the second invocation the value of the Bin would be 14 (6 + 8 = 14).
You cannot increment a String Bin. If you want to change the Bin type from String to Integer, you use “put” operation to over write the Bin with the new type and value.