I have an Array of ints in mongo db. Some of the values come up multiple times like this:
{binder : [4,7,9,7]}
I use pull on the collection like this
{ $pull: { binder: 7} }
It will remove all the 7 and I end up with:
{binder : [4,9]}
However I want to just remove one of the sevens to get something like this:
{binder : [4,7,9]}
How would I go about this. The indices of the numbers are not known and duplicates are not always on last/first spots.
After trying and searching for a long time I found a way with $indexOfArray which is not supported where I need to use it.