We're using mongodb in our grails 2.3.5 app without hibernate. When using projection in criteria with minimum two fields the result returned is a different as returned in hibernate criteria. For example:
List usersList = User.withCriteria {
projections {
id() // For mongodb
//property("id") // For hibernate
property('name', 'fullName')
}
def now = new Date()
between('joinDate', now-365, now)
maxResults(2)
}
Considering two instances are returned matching above criteria:-
Result returned when using mongodb will be:
[[1, 2], ['XYZ', 'ABC']]
While returned result when using hibernate will be:
[[1, 'XYZ'], [2, 'ABC']]
I'm not sure if this is by implementation or this is a bug.
Thank You,
SA