Module: aerospike/exp_operations

This module provides functions to easily create read/write operations using Aerospike expressions to be performed on a record via the Client#operate command.

Source:
See:

Example

const Aerospike = require('aerospike')
const op = Aerospike.operations
const exp = Aerospike.expressions
const key = new Aerospike.Key('test', 'demo', 'mykey1')
const tempBin = 'ExpVar' // this bin is to hold expression read operation output

var ops = [
  op.append('a', 'xyz'),
  op.incr('b', 10),
  exp.operations.read(tempBin,
          exp.add(exp.binInt('b'), exp.binInt('b')),
         0),
  op.read('b')
]

Aerospike.connect((error, client) => {
  if (error) throw error
  client.put(key, { a: 'abc', b: 42 }, (error) => {
    if (error) throw error
    client.operate(key, ops, (error, record) => {
      if (error) throw error
      console.log(record) // => { b: 52, ExpVar: 104 }
      client.close()
    })
  })
})

Classes

ExpOperation
ExpOperation

Methods


<static> read(bin)

Read the value of the bin.

Parameters:
Name Type Description
bin string

The name of the bin.

Source:
Returns:

Operation that can be passed to the Client#operate command.

Type
Operation

<static> write(bin, value)

Update the value of the bin.

Parameters:
Name Type Description
bin string

The name of the bin.

value any

The value to set the bin to.

Source:
Returns:

Operation that can be passed to the Client#operate command.

Type
Operation