I have documents that have dates stored in MongoDB in the UTC format: 2016-01-28T01:00:00Z
where Z represents the UTC time.
What I am trying to do is find all documents, for which the date has not expired (date_stored_in_DB > Today's Date). However I am confused about the right way of doing this.
Approach 1: Should I convert today's date into the Z-format (as shown above) first and start looking into the database? That way it would just be matching strings.
Approach 2: Should I get all records from the database and convert each date into the parsable date format like 02/03/2016 and compare with today's date? I am thinking regex here but I am not sure
Approach 3: Your suggestions?
I am using reactivemongo with scala & play framework to get this done.