I'm wondering how to get an array of objects with distinct objects. I'm managing a database where we've modifications constantly and we want to get the lasts modifications on objects in order to display them. I'm using NeDB and we can't distinct values so I've got an array of objects which is sorted by date but I don't know how to get an array of objects with unique name.
Distinct objects means :
Imagine I've got 3 objects like
{name: "Toto", modif: "added", createdAt : "05/08/2017"}
{name: "Toto", modif: "updated", createdAt: "05/09/2017"}
{name: "Toto", modif: "deleted", createdAt: "05/10/2017"}
I want to only keep the first Toto here.
We don't care about that date because the array of objects is already sorted by date.