I need to push some data in array, that stored in object Example. Bin, that I get
db.get(key) // -> { a: 'b', b: { c: [] } }
I need to push into b.c
, but I can't, because of error
db.operate(key, [Aerospike.lists.append('b.c', 1)]) // -> AerospikeError: no operations defined
Can it be solved or I can't do it?
As @pgupta correctly pointed out, you need to set the CDT context to operate on nested lists/maps. With the Node.js client, you use the ListOperation#withContext function to set the context:
db.put(key, { a: 'b', b: { c: [] } })
db.operate(key, [
Aerospike.lists.append('b', 1)
.withContext((ctx) => ctx.addMapKey('c'))
])
db.get(key) // => { a: 'b', b: { c: [1] } }