fR0DDY
fR0DDY

Reputation: 805

Which key value database shouild I use?

Here's my problem:

The table will have key-value pairs and can have multiple values for same key.

Key    Value
K1      V1
K1      V2
K2      V2
K2      V3

I will have only one type of queries:

  1. Retrieve all Keys which has all values(V(i), V(i + 1), ..., V(j)).

What is the best way of doing this?

Upvotes: 1

Views: 66

Answers (1)

joscas
joscas

Reputation: 7684

I would try mongodb. You can store documents and query like that:

db.pairs.find(
   {
     value: { $in: [ v(i), v(i+1),...,v(j)] }
   }
)

To find all elements:

db.pairs.find(
   {
     value: { $all: [ v(i), v(i+1),...,v(j)] }
   }
)

Upvotes: 1

Related Questions