Is such a operation possible?

sample record:

```
{ 
 _id: ObjectId("51d6be147483c58419000002"), 
 user: "ashok", 
 action: "login",
 time: 1373027860,
 details: { 
               user_entries:   "blah..blah", 
               url: "web.domain.com" 
                 }
 }

```

Suppose, i want to group by url visited, for each user,
group by url where user = "ashok", limit 10.

I am using [AlexBilbie](https://github.com/alexbilbie/codeigniter-mongodb-library/tree/v2) library for MongoDB-Codeigniter (it doesnt have aggregation). so using plain php.  

Still even if I could aggregate, how to distinct or limit it?  

Any suggestion is welcome.