As I dive deeper into MongoDB commands, I encountered an issue that I'm struggling to resolve. Within my collection of many users, I am attempting to update all users by adding a new field. This field should be set to true if the user registered after May 5th, 2020, and false otherwise. Here is the code snippet I used:
db.users.updateMany({},
{
$set: {
"fidelity": {
$cond: {
if: {
$gte: [
"$registration",
newDate("2020-05-05")
],
then: true,
else: false
}
}
}
}
})
The error message I received: https://i.sstatic.net/RID5K.png