1/*Another way to push items into array using Mongoose is-
2 $addToSet, if you want only unique items to be pushed into
3 array. $push operator simply adds the object to array whether
4 or not the object is already present, while $addToSet does that
5 only if the object is not present in the array so as not to
6 incorporate duplicacy.*/
7
8PersonModel.update(
9 { _id: person._id },
10 { $addToSet: { friends: friend } }
11);
12