db.collection_name.aggregate([
{$project: {
"output_field_name": {
$arrayElemAt: [
"$array_of_objects",
{
"$indexOfArray": [
"$array_of_objects.date_name",
{ "$max": "$array_of_objects.date_name" }
]
}
]
}
}}
]);
No comments:
Post a Comment