Reputation: 38
I need to create an implementation using aggregator framework that executes this projection:
{ $project : { code: $toUpper : { $substr : ["$vendor", 0, 2 ] } } }
So far I have not found a way to express the concatenation of the $substr
and $toUpper
operation using Spring. I have tried with this construction and other similar variants, but I have not succeeded.
ProjectionOperation projection = project()
.and("vendor").substring(0, 2).toLower().as("code");
Can anyone give me an idea of how to do this?
Upvotes: 1
Views: 80
Reputation: 14287
Here is the way to do it:
project()
.and(ToLower.lowerValueOf(SubstrCP.valueOf("vendor").substringCP(0, 2)))
.as("code")
Upvotes: 1