Class: Double

Double

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


new Double(value)

Creates a new Double instance.

Parameters:
Name Type Description
value number

The value of the double.

Source:
Example
const Aerospike = require('aerospike')
const Double = Aerospike.Double
const client = Aerospike.client().connect((error) => {
  if (error) throw error
})
const key = new Aerospike.Key('test', 'demo', 'myDouble')

var record = { d: 3.1415 }
client.put(key, record, (error) => {
  if (error) throw error
})

function incr (value) {
  // wrap value in Double since we can't be sure it would be converted to
  // double automatically, e.g. 1.0
  client.operate(key, [Aerospike.operations.incr('d', new Double(value))], (error) => {
    if (error) throw error
  })
}

incr(6.283)
incr(1.0)

client.get(key, (error, record) => {
  console.log(record)
  client.close()
})

Methods


value()

Source:
Returns:

value of the Double

Type
number