Database

[{"_id":"12sdsd","TotalStudent":"12","TotalPresent":"23"},{"_id":"22fdf","TotalStudent":"25","TotalPresent":"32"}]

Query

db.collection.aggregate([{$group:{_id:"",TotalStudents:{$sum:{$toInt:"$TotalStudent"}},TotalPresent:{$sum:{$toInt:"$TotalPresent"}}}}])

Result