Since mongodb I work recently tell me please there is a collection with such records
Code
{
"_id": "test1",
"clientid": "main",
"date": ISODate ("2018-04-21T09: 10: 34.705Z")
}
{
"_id": "test2",
"clientid": "main",
"date": ISODate ("2018-04-21T09: 10: 34.705Z")
}
{
"_id": "test2",
"clientid": "main",
"date": ISODate ("2018-04-21T08: 10: 34.705Z")
}
I need to delete all but the one with the maximum date and at the same time two of them have the same date. without adding new specific column to sort how can be done it For example, if the identical records by date >1000 how to delete all who have a date less and leave one with a maximum date? Using find (). Sort (date: -1) .limit (1) Thank you!