All the decimal values with valid fractions (e.g. 123.45) will be
stored as double data type in Aerospike. To store decimal values with 0
fraction as double, the value needs to be wrapped in a Double class
instance
// INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! varconfig = { hosts:'192.168.33.10:3000', // Timeouts disabled, latency dependent on server location. Configure as needed. policies: { read :newAerospike.ReadPolicy({socketTimeout :0, totalTimeout :0}), write :newAerospike.WritePolicy({socketTimeout :0, totalTimeout :0}) } } // (1.0) must be wrapped with "Double" in order to be added to another double. // (6.283) does not need to be wrapped, but it may be wrapped if convenient. ops = [Aerospike.operations.incr('d', 6.283), Aerospike.operations.incr('d', newDouble(1.0))] constkey = newAerospike.Key('test', 'demo', 'myDouble') varrecord = { d:3.1415 } Aerospike.connect(config, (error, client) => { if (error) throwerror client.put(key, record, (error) => { if (error) throwerror client.operate(key, ops, (error) => { if (error) throwerror client.get(key, (error, record) => { console.log(record.bins.d) // => 10.4245 client.close() }) }) }) })
All the decimal values with valid fractions (e.g. 123.45) will be stored as double data type in Aerospike. To store decimal values with 0 fraction as double, the value needs to be wrapped in a
Double
class instanceExample