CipherStash
CipherStash Documentation

Unique index

StashRB supports adding unique constraints on range and exact indexes.

Unique constraints are not supported on any match indexes.

If a duplicate record is inserted a CipherStash::Client::Error::RecordPutError will be raised.

Index Definition

Unique indexes can be defined with the "unique" key with value true.

In the below example schema definition, a unique constraint is defined on an exact index.

 {
    #(type definition omitted)
    "indexes" => {
        "title" => {
            "kind" => "exact",
            "field" => "email",
            "unique" => true
        }
    }
 }

Defining a unique index on any match indexes will result in a CipherStash::Client::Error::InvalidSchemaError being raised.