Questions tagged [key-value]

A key-value pair is a set of two linked data items: a key which uniquely identifies some item of data, and the value, which is either the data that is identified or a pointer to the location of that data. Key-value pairs are frequently used in lookup tables, hash tables and configuration files.

A key-value pair is a set of two linked data items: a key which uniquely identifies some item of data, and the value, which is either the data that is identified or a pointer to the location of that data. Key-value pairs are frequently used in lookup tables, hash tables and configuration files.

http://searchenterprisedesktop.techtarget.com/definition/key-value-pair

A collection of key-value pairs is called an associative array.

The concept of key value pairs is applied in modern NoSQL databases for representing a storage mechanism. Key-Value is also a way to assign attributes and values to NSObject based instances in Cocoa framework (Related: Objective-C).

3201 questions
50
votes
8 answers

how to prevent adding duplicate keys to a javascript array

I found a lot of related questions with answers talking about for...in loops and using hasOwnProperty but nothing I do works properly. All I want to do is check whether or not a key exists in an array and if not, add it. I start with an empty array…
iamsar
  • 1,080
  • 2
  • 15
  • 28
48
votes
2 answers

Steps to create and edit a plist file in Xcode

I want to add key pair values in plist. I dont know how to add the .plist file in XCode. Simply i want to add these details in .plist file named as "Mobile.plist". Apple - iPhone,iPod,iPad Samsung - Galaxy Y, Galaxy R, Galaxy Z Nokia - Lumina LG -…
Gopinath
  • 5,392
  • 21
  • 64
  • 97
48
votes
5 answers

Can the key in a Java property include a blank character?

We are getting properties (that we can not influence) out of a database and want to access them by a key/value mapping. We are facing the problem that one of the property keys includes a blank character. foo bar = barefoot This is - correctly -…
bl4ckb0l7
  • 3,839
  • 4
  • 28
  • 33
48
votes
6 answers

When to use a key-value data store vs. a more traditional relational DB?

When would one choose a key-value data store over a relational DB? What considerations go into deciding one or the other? When is mix of both the best route? Please provide examples if you can.
cdeszaq
  • 30,869
  • 25
  • 117
  • 173
48
votes
4 answers

Can I easily iterate over the values of a map using a range-based for loop?

Is it possible to iterate over all of the values in a std::map using just a "foreach"? This is my current code: std::map foo ; for (map::iterator i = foo.begin() ; i != foo.end() ; i ++ ) { MyClass *j =…
Blacklight Shining
  • 1,468
  • 2
  • 11
  • 28
46
votes
8 answers

Get index of a key/value pair in a C# dictionary based on the value

I would like to know if some property or method exists that gets the index of a specific value. I found that dictionaries have the Contains() method which returns true if the value passed in exists, so this method almost implements what I need. I…
mjsr
  • 7,410
  • 18
  • 57
  • 83
45
votes
12 answers

Key value pairs in C# Params

I'm looking for a way to have a function such as: myFunction({"Key", value}, {"Key2", value}); I'm sure there's something with anonymous types that would be pretty easy, but I'm not seeing it. The only solution I can think of is to have a params…
Quantumplation
  • 1,069
  • 1
  • 9
  • 19
44
votes
5 answers

Get selected key/value of a combo box using jQuery

Please, how can I get the selected key and value of a HTML select combo box using jQuery? $(this).find("select").each(function () { if ($.trim($(this).val()) != '') { searchString += $.trim($(this).val()) + " "; //This gives me the key.…
Amit
  • 6,839
  • 21
  • 56
  • 90
42
votes
10 answers

Reliable and efficient key--value database for Linux?

I need a fast, reliable and memory-efficient key--value database for Linux. My keys are about 128 bytes, and the maximum value size can be 128K or 256K. The database subsystem shouldn't use more than about 1 MB of RAM. The total database size is 20G…
pts
  • 80,836
  • 20
  • 110
  • 183
39
votes
7 answers

Key: value store in Python for possibly 100 GB of data, without client/server

There are many solutions to serialize a small dictionary: json.loads/json.dumps, pickle, shelve, ujson, or even by using sqlite. But when dealing with possibly 100 GB of data, it's not possible anymore to use such modules that would possibly rewrite…
Basj
  • 41,386
  • 99
  • 383
  • 673
39
votes
4 answers

Storing Directory Hierarchy in a Key-Value Data store

What is a clean/efficient method for storing the directory Hierarchy/tree in a Key-Value database (in my case MongoDB but any of them)? For example a tree structure - Cars + Audi + BMW - M5 + Ford - Color + Red - Apple …
The Unknown
  • 19,224
  • 29
  • 77
  • 93
37
votes
6 answers

Why can't I compare a KeyValuePair with default

In .Net 2.5 I can usually get an equality comparison (==) between a value and its type default if (myString == default(string)) However I get the following exception when I try to run an equality comparison on a default KeyValuePair and a…
johnc
  • 39,385
  • 37
  • 101
  • 139
37
votes
4 answers

How to check if keys exists and retrieve value from Dictionary in descending priority

I have a dictionary and I would like to get some values from it based on some keys. For example, I have a dictionary for users with their first name, last name, username, address, age and so on. Let's say, I only want to get one value (name) -…
Cryssie
  • 3,047
  • 10
  • 54
  • 81
36
votes
5 answers

What is the type of "keys" in JavaScript?

I bumbed into one of those moments when I just lose the focus and start wondering on a silly question: var a = { b: "value" } What is the typeof 'b' and I don't mean the typeof "value", but the actual Key labeled as b? background: I started…
tunylund
  • 371
  • 1
  • 3
  • 4
36
votes
5 answers

Fastest, non-memory-based, multi-process key-value store for Node.js

What is the fastest non-memory key-value store for Node.js supporting multiple processes? I need to store simple key-value string/string pairs (not documents or JSON, just strings). Here are some examples (there would be millions of…
Ruben Verborgh
  • 3,545
  • 2
  • 31
  • 43