Update array with document's own user property

i want to get the userId of a document and store it in an array of guests. but this syntax isn’t working, it just hard-codes the $user string in an array in the document:

db.channels.updateMany({}, { $addToSet: { guests: '$user' } })

You need

great! i have this and its returning the correct results but its not actually updating any documents.

db.channels.aggregate({
    $addFields: {
        guests: [{ $toString: "$user" }]
    }
})

The link I provided does not indicate to call the aggregate() method.

If you look at the updateMany example you will see that you still call updateMany as usual with the exception of the extra brackets around your update operation.