So what do you guys think? It is a bad idea? 2010/6/6 francisco treacy <francisco.tre...@gmail.com>: > I find myself using a lot this kind of functions (this one > inspired/borrowed from Sean Cribbs) - a sort of SQL's conditions > ("where"). > > Riak.mapByFields = function(value, keyData, fields) { > if(!value.not_found){ > var object = Riak.mapValuesJson(value)[0]; > for(field in fields) { > if(object[field] != fields[field]) > return []; > } > return [object]; > } else { > return []; > } > } > > Usage: > {"inputs":"test", > "query":[{"map":{"language":"javascript", > "name":"Riak.mapByFields", > "arg": { "city": "Paris" }, > "keep":true}}] > } > > Any real-world app *always* needs to query data by fields. > > Would it be a good idea to ship this by default in Riak? I do believe > so because it is sufficiently general purpose (just as > Riak.mapValuesJson). > > A lot of libraries (for instance devise-ripple) could build upon this > function without forcing clients/users to alter their app.config, > define a js_source, and include the function in all their nodes. > > What do you think? > > Francisco >
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com