Error reading map from Aerospike record

I’m trying to read a record from an Aerospike cluster using the Go client library v5. When using GetObject() I can see a map in the returned bins (although an empty map, which is correct):


Now, when trying to read into a struct with GetObject() I’m getting the error interface conversion: interface {} is []aerospike.MapPair, not map[interface {}]interface {}

This is the struct definition:

type PiiDevice struct {
    Id string `as:"id"`
    Data            map[string]int  `as:"sgfq"`

Is this a bug in the client library?

It seems that the map you are trying to retrieve is an ordered map. While this isn’t technically a bug, it means that the client does not support converting ordered maps back to structs.

I’ll look into it.

Thank you! The records are being written by a node.js app, it defaults to ordered maps apparently.

Hey @Khosrow_Afroozeh did you find anything? Is there any possible workaround?

happened to me few time, i have to do a workaround by using Get instead of GetObject and convert it manually using switch sgfq.(type) ...

Sorry, I’ll try to fix it ASAP. Although keep in mind that the v5 of the client is not supported anymore and you’ll have to upgrade to at least v6, which itself is only on limited support for a short period of time.