Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

MongoDb multi-grouping  RSS feed

vinny kapoor
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have an object in mongodb collection like:

event: "event_A",
deviceId: id1,
eventCount": 54,
timeStamp: 12343565,
metadata: {


"event" can be one of the {event_A,event_B,event_C,event_D,event_E}

Now i want to write some queries which extracts information grouped by "events" types and distinct(deviceId) . This can be easily done by mongo aggregation framework.

Now if something changed in the reporting layer and we decided to have : event_F = event_D + event_E

How can i modify my queries(grouped by event type) without affecting the data model in mongodb to get the same reporting results.

Thanks in advance
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!