I have a collection "people" with documents like this one:
{
_id: "...",
name: "...",
age: "..."
}
I want to perform an update to all the documents of this collection so they have an extra field "actualName" with the exact same content like "name". I have tried this:
db.people.updateMany({}, { $set { actualName: $name } })
But I get this error:
$name is not defined
I'm doing it from MongoSH (Compass).