Skip to content

Commit 0c5c569

Browse files
committed
wip
1 parent a474e12 commit 0c5c569

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

snooty.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ toc_landing_pages = [
1010
"/quick-start-rails",
1111
"/quick-start-sinatra",
1212
"/interact-data",
13-
"/interact-data/specify-query"
13+
"/interact-data/specify-query",
14+
"/data-modeling"
1415
]
1516

1617
[constants]

source/data-modeling/documents.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,39 @@ similar to a {+language+} hash or JSON object. You can store instances
5353
of your models directly in a collection in the database, or you can
5454
embed them in other classes that use the ``Document`` module.
5555

56+
The following code creates an instance of the ``Person`` model defined
57+
in the preceding section:
58+
59+
.. code-block:: ruby
60+
61+
Person.create(name: 'Meena Kumar')
62+
63+
The document appears in MongoDB as follows:
64+
65+
.. code-block:: json
66+
67+
{
68+
"_id": {
69+
"$oid": "673b6dce61700598c24a72b0"
70+
},
71+
"name": "Meena Kumar"
72+
}
73+
74+
.. note:: _id Field
75+
76+
When you persist an instance of a model to the database, MongoDB
77+
automatically adds an ``_id`` field that has a unique value even if you
78+
do not explicitly define this field in your model.
79+
80+
To learn more about this field, see the :manual:`ObjectId reference
81+
</reference/bson-types/#objectid>` in the {+server-manual+}.
82+
83+
Additional Information
84+
----------------------
85+
86+
To learn how to access and change your MongoDB data, see the
87+
:ref:`mongoid-interact-data` guides.
88+
5689
To learn more about how to model your data by using {+odm+} models,
5790
see the :ref:`mongoid-data-modeling` guides.
5891

0 commit comments

Comments
 (0)