In my document, the date field is a string "date": "01/08/2018"
. How can I convert it to Date object in Spring MongoDB to able to use comparator operators like "gte, lte" to other date object.
I tried:
project()
.and(DateOperators.DateFromString.fromStringOf("date")).as("date")
It just works with fields whose format is yyyy-MM-dd
, and of course I ended up with:
'Error parsing date string '26/10/2016'; 0: Unexpected character '2'
How can I pass the pattern or Is there another way to get the my goal?