MongoError: Found unexpected fields after $each in $addToSet
await Profile.updateOne(
{ ref },
{
$addToSet: {
"contact": {
$each: [ "addr" ],
$position: 0,
},
},
}
);
CodePudding user response:
$position
is a modifier for $push only, and cannot be used with $addToSet.