I need assistance in finding the most recent date within a collection. The date follows this format: YYYY-MM-DD
.
For example:
{ "release" : "2014-09-25", "desc" : "Test1", "status" : "ok", "_id" : "…" }
{ "release" : "2014-09-26", "desc" : "Test2", "status" : "ok", "_id" : "…" }
{ "release" : "2014-09-27", "desc" : "Test3", "status" : "ok", "_id" : "…" }
The desired output should be:
{ "release" : "2014-09-27", "desc" : "Test3", "status" : "ok", "_id" : "…" }
I am curious if there is a specific mongoDB operator for this scenario, or if I have to retrieve all documents and iterate through them?
Any guidance on this matter would be highly appreciated.