Skip to content

Commit 84e233c

Browse files
p-mongop
andauthored
MONGOID-5019 note that _id is only assigned for top-level documents (#4933)
Co-authored-by: Oleg Pudeyev <[email protected]>
1 parent 59c37d2 commit 84e233c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

source/tutorials/mongoid-documents.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,8 +834,10 @@ It is possible to omit the default entirely:
834834

835835
If the default on ``_id`` is omitted, and no ``_id`` value is provided by
836836
your application, Mongoid will persist the document without the ``_id``
837-
value and one will be assigned by the server. However, Mongoid will
838-
not automatically retrieve this value when the document is persisted - you
837+
value. In this case, if the document is a top-level document, an ``_id``
838+
value will be assigned by the server; if the document is an embedded document,
839+
no ``_id`` value will be assigned. Mongoid will not automatically retrieve
840+
this value, if assigned, when the document is persisted - you
839841
must obtain the persisted value (and the complete persisted document) using
840842
other means:
841843

0 commit comments

Comments
 (0)