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:

The List append() operation has a similar example.

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.

1 Like

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

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