Database
db={restaurants:[{grades:[{"grade":"A","score":8},{"grade":"A","score":7}]},{grades:[{"grade":"B","score":8},{"grade":"B","score":6}]},{grades:[{"grade":"C","score":-6},{"grade":"C","score":14}]}]}
Query
db.restaurants.aggregate([{$set:{final_modulo:{$reduce:{input:"$grades.score",initialValue:1,in:{$cond:{if:{$eq:["$$value",0]},/** in theory, once we have a 0* don't calculate mods or the minimums any more*/then:"$$value",else:{$mod:["$$this",7]}}}}}}},{$match:{final_modulo:0}}])