• Post Reply Bookmark Topic Watch Topic
  • New Topic

MongoDb multi-grouping

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

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
Vinny
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!