Class: IndexJob

IndexJob

Potentially long-running index creation job.


new IndexJob()

Source:
See:
Example
const Aerospike = require('aerospike')

let binName = 'location'
let indexName = 'locationIndex'
let options = {
  ns: 'test'
  set: 'demo'
  bin: binName,
  index: indexName,
  datatype: Aerospike.indexDataType.GEO2DSPHERE
}

Aerospike.connect()
  .then(client => {
    client.createIndex(options)
    .then(job => job.wait())
    .then(() => {
      console.info('Secondary index %s on %s was created successfully', indexName, binName)
      client.close()
    })
    .catch(error => {
      console.error('Error creating index:', error)
      client.close()
    })
  })
  .catch(error => console.error('Error connecting to cluster:',  error))

Extends

Methods


wait( [pollInterval] [, callback])

Wait until the job of creating a secondary index has completed.

Parameters:
Name Type Argument Default Description
pollInterval number <optional>
1000

Interval in milliseconds to use when polling the cluster nodes.

callback doneCallback <optional>

The function to call when the operation completes.

Overrides:
Source:
Returns:

If no callback function is passed, the function returns a Promise that resolves once the job is completed.

Type
Promise