I’m trying to figure out of we can still replace document using update command on mongo shell 5.0, documentation says we can and even following the exact example provided in it doesn’t work and gives following error:
The updateOne documentation states that the “update document” must contain only update operator expression(s) of which $set is one. The update command you’ve provided does not contain the update operator expression which is causing the error you’ve provided.
Please also note that update() is deprecated and you should instead use updateOne() or updateMany() if you are using mongosh.
You can test the below example with the $set update operator expression: