Supported data types
For the complete documentation index see: llms.txt
All documentation pages available in markdown.
The Aerospike Node.js client supports these data types for bin values:
- Boolean
- Byte array
- Double
- GeoJSON
- HyperLogLog
- Integer
- List
- Map
- String
Keys can be integers, strings, or byte arrays.
Integers
Aerospike supports storing 64-bit integers. A JavaScript Number with no fractional part, such as 123 or 2.0, is stored as an integer. For a value outside JavaScript’s safe integer range, use a BigInt. When you read an integer outside that range, the client returns a BigInt.
Examples
To use integers for key values:
const key = new Aerospike.Key("test", "demo", 123);To use integers for record bin values:
const bins = { id: 12345678, age: 32,};Doubles
Aerospike supports storing 64-bit floating-point numbers. A JavaScript Number with a fractional part is stored as a double. To store a whole number as a double, wrap it in Aerospike.Double.
Examples
To use doubles for record bin values:
const bins = { price: 9.99, weight: new Aerospike.Double(2),};Strings
Aerospike supports storing NULL-terminated strings. You can create strings using JavaScript String.
Examples
To use strings for key values:
const key = new Aerospike.Key("test", "demo", "ABC");To use strings for record bin values:
const bins = { first_name: "John", last_name: "Doe",};Byte Arrays
Aerospike supports storing byte arrays. You can create byte arrays using JavaScript Uint8Array or Node.js Buffer.
Examples
To use the Buffer byte array for key values:
const key = new Aerospike.Key("test", "demo", Buffer.from([0xa, 0xb, 0xc]));To use the Buffer byte array for record bin values:
const bins = { avatar: Buffer.from([0xa, 0xb, 0xc]), password: Buffer.from([0xa, 0xb, 0xc]),};To use the Uint8Array byte array for record bin values:
const bins = { avatar: new Uint8Array([0xa, 0xb, 0xc]), password: new Uint8Array([0xa, 0xb, 0xc]),};