{ $pull :
{ field : _value } } will removes all occurrences of value from field, if field is an array.
In my project, I need { $pull :
} removes the first occurrences of value from field.
For example:
document:
,
{"name":"jhon"},
{"name":"gavin"}]
}
As you see, the array "boys" has three elements, and the first is same
to the second. If I do {$pull:{"name":"jhon"}}, then the first and second element will be removed.
Actually, I just want to remove the first element(left the second element and the third element).
- duplicates
-
SERVER-1014 A modifier to delete a single value from an array
- Closed