On Sat, 10 Mar 2018 02:50:42 GMT, Carl Sturtivant wrote:

The following expression to use mongodb to produce a list of small documents is now broken, though it compiled and worked correctly before. It doesn't compile with any of dmd 2.077.1 , 2.078.3 or 2.079.0 :

db[collection].aggregate( 
    ["$group":["_id":"$"~variable]] 
)

and produces the error message

../../../.dub/packages/vibe-d-0.8.3/vibe-d/data/vibe/data/serialization.d(487,16): Error: functions cannot return a tuple
../../../.dub/packages/vibe-d-0.8.3/vibe-d/data/vibe/data/serialization.d(526,17): Error: template instance `vibe.data.serialization.serializeValueImpl!(BsonSerializer, DefaultPolicy).serializeValueDeduced!(Pipeline).serializeValueDeduced.safeGetMember!"pipeline"` error instantiating
../../../.dub/packages/vibe-d-0.8.3/vibe-d/data/vibe/data/serialization.d(354,115):        instantiated from here: serializeValueDeduced!(Pipeline)
../../../.dub/packages/vibe-d-0.8.3/vibe-d/data/vibe/data/serialization.d(205,58):        instantiated from here: serializeValue!(Pipeline)
../../../.dub/packages/vibe-d-0.8.3/vibe-d/data/vibe/data/serialization.d(152,49):        instantiated from here: serializeWithPolicy!(BsonSerializer, DefaultPolicy, Pipeline)
../../../.dub/packages/vibe-d-0.8.3/vibe-d/data/vibe/data/serialization.d(146,11):        ... (3 instantiations, -v to show) ...
source/database.d(114,49):        instantiated from here: aggregate!(string[string][string])

Any help would be greatly appreciated.

I've opened a ticket and will look into a fix: #2110

To work around the issue, the aggregate expression can be embedded into an array literal:

db[collection].aggregate( 
    [["$group":["_id":"$"~variable]]]
)