How does mongodb group data and then get the largest whole data in the group?

  mongodb, question

How does mongodb group arrays and get the largest whole data in the group?

Add the following statement:

db.articles.aggregate( [
 { $group: { _id: '$did', alld: { $max: '$time' } } }
 ] );

I want to group according to did field, and then, within the group, get all fields of the data with the largest time (the whole data), and the result is. Instead of the two fields _id and alld.

Is there any way to achieve this? ?

For example:
{“_id”: 1, “name”: “tom”, “sex “:”male “,”score”: 100, “age”: 34}
{“_id”: 2, “name”: “jeke”, “sex “:”male “,”score”: 90, “age”: 24}
{“_id”: 3, “name”: “kite”, “sex “:”female “,”score”: 40, “age”: 36}
{“_ id”: 4, “name”: “here”, “sex”: “male”, “score”: 90, “age”: 56}
{“_id”: 5, “name”: “marry”, “sex “:”female “,”score”: 70, “age”: 18}
{“_id”: 6, “name”: “john”, “sex “:”male “,”score”: 100, “age”: 31}

Group according to sex, and then get all the fields of the person with the highest score. ? ? How did mongodb come true? ?