new Key(ns, set, key, digestopt)
A key uniquely identifies a record in the Aerospike database within a given namespace.
- Description:
Key Digests
In your application, you must specify the namespace, set and the key itself to read and write records. When a key is sent to the database, the key value and its set are hashed into a 160-bit digest. When a database operation returns a key (e.g. Query or Scan operations) it might contain either the set and key value, or just the digest.
- Source:
Example
const Aerospike = require('aerospike')
const Key = Aerospike.Key
var key1 = new Key('test', 'demo', 12345)
var key2 = new Key('test', 'demo', 'abcde')
var key3 = new Key('test', 'demo', Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]))
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
ns |
string | The Namespace to which the key belongs. |
|
set |
string | The Set to which the key belongs. |
|
key |
string | number | Buffer | The unique key value. Keys can be strings, integers or an instance of the Buffer class. |
|
digest |
string |
<optional> |
The digest value of the key. |
Members
digest :Buffer
The 160-bit digest used by the Aerospike server to uniquely identify a record within a namespace.
Type:
- Buffer
key :string|integer|Buffer
Type:
- string | integer | Buffer
ns :string
Type:
- string
set :string
Type:
- string