Database
[{phrase:"This is phrase 1 of author 1",phraseLength:50,author:"Author 1",},{phrase:"This is phrase 1 of author 1",phraseLength:150,author:"Author 1",},{phrase:"This is phrase 1 of author 1",phraseLength:10,author:"Author 1",},{phrase:"This is phrase 1 of author 2",phraseLength:20,author:"Author 2",},{phrase:"This is phrase 2 of author 2",phraseLength:180,author:"Author 2",},{phrase:"This is phrase 3 of author 2",phraseLength:50,author:"Author 2",},]
Query
db.collection.aggregate([{$setWindowFields:{partitionBy:"$author",sortBy:{null:1},output:{"cumuLength":{$sum:"$phraseLength",window:{documents:["unbounded","current"]}}}}},{$group:{_id:"$author",phrases:{$push:{$cond:[{$lte:["$cumuLength",200]},{phrase:"$phrase",phraseLength:"$phraseLength",author:"$author"},"$$REMOVE"]}}}}])