skip to Main Content

String aggregation in MongoDB

I have a collection of documents as follows: { "id": ..., "key": 47 }, { "id": ..., "key": 12 } I want to aggregate the whole collection to a single string, by concatenating the keys, delimited by |. So here,…

VIEW QUESTION

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

MongoDB format data in an array of objects

I have data on a MongoDB collection stored in documents like these: { "_id": "657c54befca2b6a2cdd935ba", "data": { "name": "Bob", "surname": "xxx", "age": "20", }, "header": { "data": "1702646974156", } "_class": "Prova" } { "_id": "657c54befca2b6a2cdd935bb", "data": { "name": "Tom", "surname":…

VIEW QUESTION
Back To Top
Search