How can I convert this code to java? How to use aggregation framework in java ? Can anyone please help me out...
My java code:
Document update = new Document("$project",new Document("TOTAL_EMPLOYEE_SALARY",new Document("$sum","$employees.EMP_SALARY")));
AggregationOutput output = coll.aggregate(update); // throwing some error in eclipse
My mongo shell code :
db.collection.aggregate([
{ "$project": {
"TOTAL_EMPLOYEE_SALARY": {
"$sum": "$employees.EMP_SALARY"
}
}}
])