MongoDB has a $push
operator and an $addToSet
operator, both of which do a very similar thing.
Both operators append values to an existing array. The main difference is in how they deal with arrays that already contain the value you’re trying to append, and also in the modifiers that can be used.
Continue reading