Python client LIST_WRITE_ADD_UNIQUE policy flag usage

Trying to configure a write policy with LIST_WRITE_ADD_UNIQUE to ensure only unique values get added to a bin list, but can’t seem to figure out the correct syntax.

Have tried adding to a policy:

policy =  { 
    'map_order': aerospike.MAP_KEY_VALUE_ORDERED,
    'map_write_flags': aerospike.MAP_WRITE_FLAGS_CREATE_ONLY,
    # neither of these add unique flags are working
    'list_write_flags': aerospike.LIST_WRITE_ADD_UNIQUE,
    'write_flags': aerospike.LIST_WRITE_ADD_UNIQUE
  }

Can someone provide an example using this flag?

Thx!

The documentation of the List append_items() operation includes examples for this situation:

https://github.com/aerospike-examples/aerospike-operations-examples/blob/master/append_items.py#L32-L53

The List append() operation has a similar example.

https://github.com/aerospike-examples/aerospike-operations-examples/blob/master/append.py#L32-L53

Just to be clear, the list_order policy only applies to a newly created list. Once it is created, you can only change its ordering using the set_order operation.

Thank you. This issue can be closed (didn’t see where to do that).