I am new to Java. I checked few examples having aggregate usage.But still having few doubt.
db.employee.aggregate({$unwind: '$dp.fin.Record'},
{$match:{"dp.mon":"patch.metrics",'dp.fin.Record':{$exists:1}}},
{$group:{_id: '$dp.fin.Record', count:{$sum:1}}},
{$project:{count:'$count'}}, {$group:{_id:'Total
Count',total:{$sum:'$count'}}});
Can anybody help me writing java equivalent. I have doubt how can we pass multiple matching condition as I have shown above. I am trying like below
BasicDBObject unwind = new BasicDBObject("$unwind",
"$dp.fin.Record"); DBObject match = new BasicDBObject("$match", new
BasicDBObjectBuilder(""));