I am trying to build a criteria of comparing the value of a derived property of adding two fields as shown in Can I do a math operation inside a createCriteria, i.e.
class SumFormula {
Integer column1
Integer column2
Integer sum
static mapping = {
sum formula: 'column1 + column2'
}
}
and the criteria:
SumFormula.createCriteria().list() {
ne("sum", 100)
}
However I could not make it work with MongoDB. The derived property is always null when printed out.
The above cited post did mention that derived properties are SQL expressions, so the questions is that are the derived properties only available with GORM for SQL? Any alternative for GORM for MongoDB?