skip to Main Content

Mongodb Aggregate events between two events

I have a collection made like this [ {timestamp: xxx, type:'start'}, {timestamp: xxx, type:'log'}, {timestamp: xxx, type:'log'}, {timestamp: xxx, type:'log'}, {timestamp: xxx, type:'start'}, {timestamp: xxx, type:'log'}, {timestamp: xxx, type:'log'} ] how do I aggregate the start event and the log…

VIEW QUESTION

Mongodb – Mongo aggregation to fetch indexed values from string

Here is the sample document { "pId":12345, "charges": { "key1": "10.0,11.0,12.0,13.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0", "key2": "22.5%,12.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%,22.5%", "key3": "271.95,371.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,271.95,394.45,271.95,394.45", ... } } Charge keys are dynamic. I wanted to fetch the requested index values from charges Ex: input index is (1, 2) the expected…

VIEW QUESTION
Back To Top
Search