Skip to content

Commit cfc8c0f

Browse files
author
Sam Kleinman
committed
DOCS-896 section about document growth in write operations
1 parent dd4342b commit cfc8c0f

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

source/core/write-operations.txt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,32 @@ write operation that affects multiple documents using the
342342
To isolate a sequence of write operations from other read and write
343343
operations, see :doc:`/tutorial/perform-two-phase-commits`.
344344

345+
Updates
346+
-------
347+
348+
Each document in a MongoDB collection has allocated *record space*
349+
which includes the entire document *and* a small amount of
350+
padding. This padding makes it possible for update operations to
351+
increase the size of a document slightly without causing the document
352+
to outgrow the allocated record size.
353+
354+
Documents in MongoDB can grow up to the full maximum :limit:`BSON
355+
document size <BSON Document Size>`; however, when documents outgrow
356+
their record size MongoDB must allocate a new record and move the
357+
document to the new record. Update operations that do not cause a
358+
document to grow, (i.e. *in-place* updates,) are significantly more
359+
efferent than those updates that cause document growth. Use :doc:`data
360+
models </core/data-modeling>` that minimize the need for document
361+
growth when possible.
362+
363+
For complete examples of update operations, see
364+
:doc:`/applications/update`.
365+
345366
.. _write-operations-padding-factor:
346367

347368
Padding Factor
348369
--------------
349370

350-
351371
If an update operation does not cause the document to increase in
352372
size, MongoDB can apply the update in-place. Some updates
353373
change the size of the document, for example using the

0 commit comments

Comments
 (0)