, free & fully virtual. June 9th - 10th. Register Now

Update $set vs document replacement operations

I’m facing a completely different behaviour on a data node between $set and document replacement operations.
Whenever I use $set, there is a huge spike of WiredTiger cache eviction plus an increase of read IOPS. If I replace the document, I don’t see this behaviour.
Note: the $set is not setting any array field.

Can someone please help me to understand the different behaviour? Is it due to the fact that document replacement doesn’t pull the document into memory?


It would be helpful to have more details. For instance: what version of MongoDB? Default settings? Replica set? Size of document? Exact $set clause? Single document update? What’s the query? Both updates would be most useful.