Sunday, 15 February 2015

indexing - Couchbase multi-dimensional keys -



indexing - Couchbase multi-dimensional keys -

i'm newbie couchbase , trying understand whether fits domain. have next data:

birth city name 1980 john 1981 b rick 1982 ase 1983 c max 1984 c bob 1980 rick 1983 d john 1982 bob 1985 c bob

and not getting on how implement similar next sql query:

select birth tbl city in (a,c) , name (bob, rick)

to next data:

1984 c bob 1980 rick 1982 bob 1985 c bob

one big difference 'startkey' , 'endkey' view usages it's not range selection, it's 2 different dimension values.

in real scenario need set 1-5000 id's 'in' statement. 1 way found utilize indexing , n1ql http://docs.couchbase.com/prebuilt/n1ql/n1ql-dp3/#create-index.html seems not fastest way access data.

what's best practice access multi-dimensional key info lots of keys values? is okay create big 'in' statements in n1ql?

you should view emit function, including key 2 dimension values, , returning value, in way:

emit([doc.name, doc.city], doc.birth);

and have query param keys:

keys=[["bob", "a"], ["bob", "c"], ["rick", "a"], ["rick", "c"]]

indexing couchbase

No comments:

Post a Comment