Answers for "add new element in array mongodb"

2

mongodb add to array if not exists

db.tags.update(
    {name: 'sport'},
    {$addToSet: { videoIDs: "34f54e34c" } }
);
Posted by: Guest on October-22-2020
3

mongodb push to arry in update

db.collection.update({_id:xx}, {$pop:{letters : -1}})
Posted by: Guest on March-22-2020

Code answers related to "add new element in array mongodb"

Browse Popular Code Answers by Language