The record passed to the query callback function does not have the key populated correctly


I have only one bin. I do a query on it with aerospike_query_foreach(), my callback function gets called (yeah!) and I see the bin value which I used for the query in the first place (no big surprise here).

However, what I really want is the key value.

I examine rec->key.value.integer.value and it is 0 when in reality it should be 999 (in my trivial test case).

What gives?

P.S.: I use the community edition on Ubuntu 20.04

By default, Aerospike clients don’t send your key to the server. They only send the 20 byte RIPEMD160 hash of your (key+setname+keytype). If, in addition, you want to send “your” key to the server, in client policy, use sendKey=true – (or equiv. depending on which client you are using). Then try the above test…

Thank you, this did the trick.

© 2021 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.