Hello everyone.
I’m quite new working with Mongo and I have a question that I wasn’t able to solve reading info and finding similar issues.
In my application we had an initial bad design and we used Java maps to model our document. This wouldn’t be a problem if it was not because we put in the key a dynamic value instead of a fixed one and put inside the key and the value.
I will clarify this with an example:
{
"_id": "myId",
"plannedMap": {
"entryKey_1": "2022-10-10T20:32:20Z",
"entryKey_2": "2022-10-11T20:32:20Z"
},
"executedMap": {
"2022-10-11T20:32:20Z": [
{
"calendarEntryKey": "entryKey_2",
"count": 0,
"quantity": 0,
"executed": true
}
}
What I need is to get each combination of entryKeyX - date - executedValue and save it in another collection to remove this one.
The problem I have is how to get the key and value from plannedMap. With this, i could go to executedMap and retrieve the values.
Or maybe it’s easier get them directly from executedMap, but i didn’t find a way to do it without knowing the key of the map.
Thanks in advance.
Regards.