The name of the bin. The bin must contain a List value.
Zero-based index of the item to remove.
Optional
returnType: lists.returnTypeThe return type indicating what data of the removed item(s) to return (if any).
List operation that can be used with the Client#operate command.
returnType
, you can also use
~ListOperation#andReturn|ListOperation#andReturn to
select what data to return.const Aerospike = require('aerospike')
const lists = Aerospike.lists
const key = new Aerospike.Key('test', 'demo', 'listsTest')
// 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: {
write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}),
operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0})
}
}
Aerospike.connect(config).then(async client => {
await client.put(key, { tags: ['blue', 'yellow', 'pink'] })
const ops = [
lists.removeByIndex('tags', 1)
.andReturn(lists.returnType.VALUE)
]
const result = await client.operate(key, ops)
console.log('Result:', result.bins.tags) // => Result: yellow
const record = await client.get(key)
console.log('Record:', record.bins.tags) // => Record: [ 'blue', 'pink' ]
client.close()
})
Removes a single list element identified by its index from the list.