Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

add to a list mongoose

PersonModel.update(
    { _id: person._id }, 
    { $push: { friends: friend } },
    done
);

// if you want unique items only
PersonModel.update(
  { _id: person._id }, 
  { $addToSet: { friends: friend } }
);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #add #list #mongoose
ADD COMMENT
Topic
Name
9+7 =