@@ -26,7 +26,7 @@ collection.
26
26
27
27
You can use methods provided by the {+framework+} ``QuerySet`` API to run
28
28
CRUD operations. To run these operations, you can call ``QuerySet`` methods
29
- on your model's ``Manager`` . The ``Manager`` class handles database
29
+ on your model's manager . The ``Manager`` class handles database
30
30
operations and allows you to interact with your MongoDB data by referencing
31
31
Django models. By default, {+framework+} adds a ``Manager`` named ``objects``
32
32
to every model class.
@@ -76,6 +76,13 @@ The ``Movie`` model class has the following definition:
76
76
def __str__(self):
77
77
return self.title
78
78
79
+ The ``Movie`` model class includes an inner ``Meta`` class and a ``__str__()`` method.
80
+ To learn about these model features, see :ref:`django-models-define` in the
81
+ Create Models guide.
82
+
83
+ Run Code Examples
84
+ `````````````````
85
+
79
86
You can use the Python interactive shell to run the code examples.
80
87
To enter the shell, run the following command from your project's
81
88
root directory:
@@ -103,7 +110,7 @@ Insert Documents
103
110
----------------
104
111
105
112
To insert a document into a collection, call the ``create()`` method on your
106
- model's ``Manager`` class . Pass the new document's field names and field values
113
+ model's manager . Pass the new document's field names and field values
107
114
as arguments to the ``create()`` method.
108
115
109
116
Example
@@ -128,14 +135,18 @@ code:
128
135
movie = Movie(title="Poor Things", runtime=141)
129
136
movie.save()
130
137
138
+ .. tip::
139
+
140
+ To learn more about the
141
+
131
142
.. _django-crud-read:
132
143
133
144
Read Documents
134
145
--------------
135
146
136
147
To retrieve documents from your collection, call the ``filter()`` method
137
- on your model's ``Manager`` class . Pass a query filter, or criteria
138
- that specifies which documents to retrieve, as an argument to the ``filter()`` method.
148
+ on your model's manager . Pass a query filter, or criteria that specifies
149
+ which documents to retrieve, as an argument to the ``filter()`` method.
139
150
140
151
Alternatively, you can call the ``get()`` method to retrieve a single document
141
152
that matches your query.
@@ -204,9 +215,9 @@ Modify Documents
204
215
----------------
205
216
206
217
To modify documents in a collection, call the ``filter()`` and ``update()``
207
- methods on your model's ``Manager`` class . Pass a query filter,
208
- or criteria that specifies which documents to update, as an argument to the
209
- ``filter()`` method. Then, pass the fields and values you want to update as
218
+ methods on your model's manager . Pass a query filter, or criteria that
219
+ specifies which documents to update, as an argument to the ``filter()``
220
+ method. Then, pass the fields and values you want to update as
210
221
arguments to the ``update()`` method.
211
222
212
223
Example
0 commit comments