I have a data:
{'_id': 0, 'values': [{'value': 1, 'value_type': 'type1'}, {'value': 2, 'value_type': 'type2'}, {'value': 134, 'value_type' : 'type1'}, {'value': 2564, 'value_type': 'type212'}]}
{'_id': 1, 'values': [{'value': 136, 'value_type': 'type1'}, {'value': 465652, 'value_type': 'type1'}, {'value': 4, 'value_type' : 'type299'}, {'value': 112564, 'value_type': 'type2456'}]}
I'm working with pymongo 2.2 and Python 3.2.
The goal is to find the dictionary (value and value_type) which has value_type
is equal to type1
and minimal value of value
to remove them. In my case, that's {'value': 1, 'value_type': 'type1'} and {'value': 136, 'value_type': 'type1'}
and I want to remove them.
How do I to achieve that?
--Edit--
I'm aware how to update (delete in my case), I'll be using $unset operator. What I'm unaware is how to find the values I need to remove.