I could not find Aggregation Group support in Morphia. So I am trying to use base Java driver for it. I think I got it working. But I need help in walking/parsing the results. How do you parse/walk the DBObject that is the result of group operation below?
DBObject dbobj = col.group(key, cond, initial, "function (obj, prev) {prev.count++;}");
With corresponding Mongo shell script, this output looks like
[
{
"managedEntityId" : ObjectId("5092ad290cf24adee7e8a77c"),
"severity" : "info",
"count" : 2
},
{
"managedEntityId" : ObjectId("5092ad290cf24adee7e8a77c"),
"severity" : "minor",
"count" : 4
}
]
If I figure it out, I will post my results here. But if somebody already knows the answer, it will save me time.
Ajay