Rethinkdb如何使用唯一键进行选择

I am trying use rethinkdb to store chat message, here is the json stored:

{
"body":  "Hi" ,
"created_at": Wed Aug 10 2016 05:39:57 GMT+00:00 ,
"from_user_id":  "user11" ,    
"send_direction":  "client" ,
"to_user_id":  "user10",
}

each user may send many message, now I want to select one message for each unique from_user_id with the latest created_at. How can I write the rethink query? I am using golang rethinkdb driver. Thanks

I think you already solved this, but this would be the group query to achieve what you want.

r.DB("example").Table("messages").Group("from_user_id").Max("created_at").Ungroup()