Pushing to an array within an object in an array

Hello, I can’t seem to figure out how to do push a string into the modifications array using the pymongo library. I’d also like to know how would I pull a specific string from that array.

This is my example document:
image

Thank you for your help.

Maybe you could refactor to make an “items.item_id” to better target modifications? If items are objects key/value (dict) rather than a list, it will be easier to find and $push modification list.

Otherwise you might need to grab all items loop through them, find item and use index nr to target modifications via update_one (upsert=True)