Database

[{"_id":ObjectId("64a41fb3f93125f5a78ead34"),"win":true},{"_id":ObjectId("64a41fb3f93125f5a78ead35"),"win":true},{"_id":ObjectId("64a41fb3f93125f5a78ead36"),"win":false},{"_id":ObjectId("64a41fb3f93125f5a78ead37"),"win":true},{"_id":ObjectId("64a41fb3f93125f5a78ead38"),"win":true},{"_id":ObjectId("64a41fb3f93125f5a78ead39"),"win":false},{"_id":ObjectId("64a41fb3f93125f5a78ead3a"),"win":true},{"_id":ObjectId("64a42174f93125f5a78ead3b"),"win":true},{"_id":ObjectId("64a42174f93125f5a78ead3c"),"win":true},{"_id":ObjectId("64a42174f93125f5a78ead3d"),"win":false},{"_id":ObjectId("64a42174f93125f5a78ead3e"),"win":true},{"_id":ObjectId("64a42174f93125f5a78ead3f"),"win":true},{"_id":ObjectId("64a42174f93125f5a78ead40"),"win":false},{"_id":ObjectId("64a42174f93125f5a78ead41"),"win":true},{"_id":ObjectId("64a42174f93125f5a78ead42"),"win":true},{"_id":ObjectId("64a42174f93125f5a78ead43"),"win":true}]

Query

db.collection.aggregate([{$project:{outVal:{$cond:{if:{$eq:["$win",true]},then:"1",else:"0"}}}},{$group:{_id:null,allRuns:{$push:"$outVal"}}},{$project:{totalString:{$reduce:{input:"$allRuns",initialValue:"",in:{$concat:["$$value","$$this"]}}}}},{$project:{splitItems:{$split:["$totalString","0"]}}},{$unwind:"$splitItems"},{$project:{length:{$strLenCP:"$splitItems"}}},{$sort:{length:-1}},{$limit:1}])

Result