Database
[{"username_id":"user01","passwordList":[{"passwordDate":{"$numberLong":"20230111012612"},"pass":"aaaa"},{"passwordDate":{"$numberLong":"20230111012614"},"pass":"bbbbb"},{"passwordDate":{"$numberLong":"20230111012900"},"pass":"ccccc"},]}]
Query
db.collection.aggregate([{"$match":{"username_id":"user01"}},{$set:{maxPasswordDate:{"$max":"$passwordList.passwordDate"}}},{"$set":{"lastPassword":{"$first":{"$filter":{"input":"$passwordList","cond":{"$eq":["$maxPasswordDate","$$this.passwordDate"]}}}}}},{"$project":{"lastPassword":1,"_id":0}}])