Function create

  • Creates list create operation.

    Parameters

    • bin: string

      bin name.

    • Optionalorder: lists.order

      list order.

    • Optionalpad: boolean

      If true, the context is allowed to be beyond list boundaries. In that case, nil list entries will be inserted to satisfy the context position.

    • OptionalpersistIndex: boolean

      If true, persist list index. A list index improves lookup performance, but requires more storage. A list index can be created for a top-level ordered list only. Nested and unordered list indexes are not supported.

    • Optionalctx: Context

      optional path to nested list. If not defined, the top-level list is used.

    Returns ListOperation

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

    const Aerospike = require('aerospike')
    const lists = Aerospike.lists
    const key = new Aerospike.Key('test', 'demo', 'listKey')

    // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE!
    var config = {
    hosts: '192.168.33.10:3000',
    // Timeouts disabled, latency dependent on server location. Configure as needed.
    policies: {
    operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0})
    }
    }

    Aerospike.connect(config).then(async client => {
    let ops = [
    lists.create('list', lists.order.ORDERED, false, true)
    ]
    let result = await client.operate(key, ops)
    console.log(result.bins) // => { list: null }
    let record = await client.get(key)
    console.log(record.bins) // => { list: [] }

    await client.remove(key)
    client.close()
    })
MMNEPVFCICPMFPCPTTAAATR