On MongoDB, how can I select elements with the most recent date from this list :
[{
"_id" : ObjectId("5c5064f39d0c4b52cf6d1d55"),
"Date" : "12-09-2018",
"Type" : "A",
"Value" : 73650.14
},
{
"_id" : ObjectId("5c5064f39d0c4b52cf6d1d15"),
"Date" : "12-09-2018",
"Type" : "B",
"Value" : 73650.14
},
{
"_id" : ObjectId("5c5064f39d0c4b52cf6d1d58"),
"Date" : "13-09-2018",
"Type" : "A",
"Value" : 80000
},
{
"_id" : ObjectId("5c5064f39d0c4b52cf6d1d56"),
"Date" : "13-09-2018",
"Type" : "B",
"Value" : 800000
}]
In order to obtain this list :
[{
"_id" : ObjectId("5c5064f39d0c4b52cf6d1d58"),
"Date" : "13-09-2018",
"Type" : "A",
"Value" : 80000
},
{
"_id" : ObjectId("5c5064f39d0c4b52cf6d1d56"),
"Date" : "13-09-2018",
"Type" : "B",
"Value" : 800000
}]
It is probably easy but I just cannot make it despite many researches. I tried to make it with the $group operator but I have never found how to push the desired values (either I only got the Date or all elements without any filter).
I am new on Mongo DB and I would really appreciate your help.
Thanks