A possible workaround with an aggregation database is to use $ project to calculate the author name. However, it is dirty, since you need to manually scroll through different sizes of names:
Here we compute the field name as a substring after the "_" character, trying every possible position (which is why there is a chain from $ cond) and is discarded when only $ author is returned if the first name is too long:
http://mongotry.herokuapp.com/#?bookmarkId=52fb5f24a0378802003b4c68
[ { "$project": { "author": 1, "pageViews": 1, "name": { "$cond": [ { "$eq": [ { "$substr": [ "$author", 0, 1 ] }, "_" ] }, { "$substr": [ "$author", 1, 999 ] }, { "$cond": [ { "$eq": [ { "$substr": [ "$author", 1, 1 ] }, "_" ] }, { "$substr": [ "$author", 2, 999 ] }, { "$cond": [ { "$eq": [ { "$substr": [ "$author", 2, 1 ] }, "_" ] }, { "$substr": [ "$author", 3, 999 ] }, { "$cond": [ { "$eq": [ { "$substr": [ "$author", 3, 1 ] }, "_" ] }, { "$substr": [ "$author", 4, 999 ] }, { "$cond": [ { "$eq": [ { "$substr": [ "$author", 4, 1 ] }, "_" ] }, { "$substr": [ "$author", 5, 999 ] }, "$author" ] } ] } ] } ] } ] } } }, { "$group": { "_id": "$name", "viewsPerAuthor": { "$sum": "$pageViews" } } } ]