Difference between SendKey being True and false

pk
go
query

#1

Hi I’m trying understand the purpose of policy SendKey=true/false (writepolicy) I tried putting a record using Golang library of aerospike with policy.SendKey as true and even as false. When I get those records(using aerospikelib.Get(policy,key)) I don’t see any difference in the result. In both the cases I don’t see PK field/value in the Bins. What I’m missing here?. Is there any way to get PK value in the Bins?

Thanks in Advance!!


#2

sendKey will let you detect key collision error - more on key collision here: What will Aerospike do if there is a hash collision (two records have the same key)?

if sendKey is true, key is stored in one of the metadata fields. AQL shows the key if you set record_print_metadata to true which leads me to conclude that if you store the key with sendKey = true, there is a way to retrieve it.