Map and Reduce Operation in Mongo-Db Query using JAVA - Springboot

Did you mean to use "$$this" to reference the variable?

I just noticed in $reduce you’re also using $this and $value instead of $$this and $$value.