Reputation: 9173
I'm using riak-js and node.js
If I have a document as follows:
{ 'skey1': 'val1',
'skey2': 'val2',
......,
'skeyn': 'valn'
}
How can I return a document that has skey2 = 'val2'? How would this be done in node.js / riak-js?
Upvotes: 0
Views: 50
Reputation: 28356
If your storage backend is riak_kv_eleveldb_backend, you can use secondary indexing.
db.save('airlines', 'KLM', {country: 'NL', established: 1919}, {index: {country: 'NL', established: 1919}});
and query like
db.query('airlines', {country: 'NL'});
(the above snippets shamelessly stolen from riak-js.org
Upvotes: 1