What is a way to remove one item from an array of mostly identical items in MongoDB?

33 views Asked by At

Say I have this document in a MongoDB collection.

{ stuff: [ a, a, b, a, b, a, a] }

I want to remove a single "b" from stuff.

If I do $pull:{stuff:"b"} then it removes both of the b's. I can't use $pop because the b's aren't on the end.

Just curious if there is a way that I'm missing.

0

There are 0 answers