Currently mongo-knex does not allow setting up relations which use an
aggregate function, e.g. filtering based on the SUM of a related column.
I initially looked at adding a new relation type like
oneToOneAggregate but this proved to require large changes to the
codebase, with a big increase in complexity.
The approach here is to allow consumers of the library to have the
ability to define a virtual table as a knex query, which allows for more
complex relations, including aggregates, or joins over multiple tables.
⚠️ blocked to be merged until MySQL 5 has been dropped in Ghost
refs https://github.com/TryGhost/Team/issues/944
Currently mongo-knex does not allow setting up relations which use an aggregate function, e.g. filtering based on the SUM of a related column.
I initially looked at adding a new relation type like
oneToOneAggregate
but this proved to require large changes to the codebase, with a big increase in complexity.The approach here is to allow consumers of the library to have the ability to define a virtual table as a knex query, which allows for more complex relations, including aggregates, or joins over multiple tables.