MongoDB Updates and Performances
Each document in a collection has allocated record space which includes the document and a small amount of padding, which makes it possible for update operations to increase the size of a document slightly without outgrowing its slot.
When an update makes the document bigger than its allocated size, it cannot possibly happen in place: MongoDB will recreate the document in a new location, where more space can be reserved in order to store it, and delete the old version.
From the user point of view, this move is transparent: the document is still there, in the same collection, only its physical location changed. But it impacts on performances.
First, and most obvious, the single update is slown down by the creation of the new copy of the document. Second, the collection will lose contiguity and get fragmented over different portions (extents) of the data files, slowing down subsequent search operations.















