Hello guys,
I’m struggling a bit trying to update my document on Mongo 4.4.
Is pretty straightforward:
db.getCollection("cs").updateOne(
{},
[
{
$set: {
"forwardData.clients.$[].relayedEndpoints": [{
type: "vehicle",
endpoint: "$forwardData.vehicle.path"
}]
}
}
]
);
Running the query above, i’m facing this error:
Invalid $set :: caused by :: FieldPath field names may not start with ‘$’.
After some research, i saw some forum answers to similar problems to remove the brackets from the second argument. It doesn’t throw any errors doing this, but the value are being saved as a string with the field name instead of his value.
Could you guys tell me what i’m doing wrong? I tried with $push instead of $set too, and got the same result.
