Hi Francisco, I just pushed this to Riak tip ( http://hg.basho.com/riak/changeset/d026576d5330).
Feel free to check it out whenever and let us know if it works for you. Thanks, Andy On Sat, Jun 12, 2010 at 12:22 PM, francisco treacy < francisco.tre...@gmail.com> wrote: > Great! Thanks for creating the issue. > > 2010/6/12 Andy Gross <a...@basho.com>: > > > > I'm already all up in Bugzilla today, so I just > > created http://issues.basho.com/show_bug.cgi?id=237 to track this. I'm > in > > favor of adding it too. > > Andy Gross <a...@basho.com> > > VP, Engineering > > Basho Technologies, Inc. > > http://basho.com > > > > On Sat, Jun 12, 2010 at 9:53 AM, Sean Cribbs <s...@basho.com> wrote: > >> > >> Best thing is to open a Bugzilla issue so it can get scheduled for a > >> release. I for one am in favor of it. > >> > >> Sean Cribbs <s...@basho.com> > >> Developer Advocate > >> Basho Technologies, Inc. > >> http://basho.com/ > >> > >> On Jun 12, 2010, at 9:44 AM, francisco treacy wrote: > >> > >> > 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 > >> > >> > >> _______________________________________________ > >> riak-users mailing list > >> riak-users@lists.basho.com > >> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > > > > > --
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com