1 Reply Latest reply: Jan 4, 2012 9:37 AM by greybird RSS

    Understand how keys works

      Hi all,

      Please can we use key as a set?
      Example: We use a profile name (accountant) as major key and minor keys as elements (names and email of 10 accountants for example) in that set.
        • 1. Re: Understand how keys works
          Yes. Since all keys are unique in a store, the keys form a set.

          Normally it is best to think of a key-value store (such as NoSQL DB) as a map, not a set, because each key has an associated value. But the value is optional (the value byte array can be zero length). We expect that most applications will store values (with non-zero lengths) with each key, but this is not required.

          In addition, even when keys have values (with non-zero lengths), there are APIs to retrieve the keys alone, without their associated values. See KVStore.multiGetKeys, for example. This method returns SortedSet<Key>, in other words, it returns a set of keys.