Translating SQL Queries using map, reduce, and filter in JavaScript
zsoltnagy.eu
zsoltnagy.eu
As an aside: You could optimise this in sql by providing indices on some of the fields and the DB would then perform a full index scan rather than a table scan.
You can use the same strongly typed Linq expression with anything.
The problem is not about using map/reduce, is that you need to return them as AST, so you can do the whole compiler dance to optimize them, instead of interpret right away that is the default.
Also, know this is usefull when you want to post-process the data after the SQL have run, and you need to do some extra pass in the client... Instead of the ad-hoc most do.