Database

[{"hostname":"google.com","path":"/index.html"},{"hostname":"google.com","path":"/page2.html"},{"hostname":"facebook.com","path":"/"},{"hostname":"facebook.com","path":"/user.php"}]

Query

db.collection.aggregate([{"$group":{"_id":"$hostname","path":{"$first":"$path"}}}])

Result