Like all alternatives to SQL I have seen, this is not as lean and readable as SQL.
The trade-offs are usually worth it, vs, doing something like:
const row = db.query('select whatever from wherever');
const obj = {
id: row.id,
brand: row.brand,
... etc
};On our projects, which are moderately small, I genuinely don't know if it is/was worth the hassle of setting up, vs. writing some repeated code. (We also have a pretty decent testing culture in place, so I would be much more accepting of DRY-violations.)
bmws = Cars.query().where( { brand: "BMW" }).groupBy('year').orderBy('year')
bmwAvg = bmws.select(avg('price'))
bmwMin = bmws.select(min('price'))
bmwMax = bmws.select(max('price'))