Skip to content

Commit 1527fce

Browse files
committed
wip
1 parent c36ee96 commit 1527fce

24 files changed

+701
-629
lines changed

source/crud.txt

Lines changed: 180 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,14 @@ CRUD Operations
2222
:titlesonly:
2323
:maxdepth: 1
2424

25-
Insert Documents </insert>
26-
Query Documents </query>
27-
Update Documents </update>
28-
Delete Documents </delete>
29-
Bulk Write Operations </bulk-write>
30-
Transactions </transactions>
31-
Configure CRUD Operations </configure>
32-
Store Large Files </gridfs>
33-
Geospatial Queries </geospatial>
25+
Insert Documents </crud/insert>
26+
Query Documents </crud/query>
27+
Update Documents </crud/update>
28+
Delete Documents </crud/delete>
29+
Bulk Write Operations </crud/bulk-write>
30+
Transactions </crud/transactions>
31+
Configure CRUD Operations </crud/configure>
32+
Store Large Files </crud/gridfs>
3433

3534
Overview
3635
--------
@@ -44,16 +43,184 @@ to MongoDB with various settings.
4443
provided in each section.
4544

4645
To use a connection example from this page, copy the code example into the
47-
:ref:`sample application <pymongo-connect-sample>` or your own application.
46+
:ref:`sample application <pymongo-crud-sample>` or your own application.
4847
Be sure to replace all placeholders in the code examples, such as ``<hostname>``, with
4948
the relevant values for your MongoDB deployment.
5049

51-
.. _pymongo-connect-sample:
50+
.. _pymongo-crud-sample:
5251

5352
.. include:: /includes/usage-examples/sample-app-intro.rst
5453

55-
.. literalinclude:: /includes/usage-examples/connect-sample-app.py
54+
.. literalinclude:: /includes/usage-examples/crud-sample-app.py
5655
:language: python
5756
:copyable: true
5857
:linenos:
59-
:emphasize-lines: 4-6
58+
:emphasize-lines: 4-6
59+
60+
Insert One
61+
----------
62+
63+
.. literalinclude:: /includes/usage-examples/write-code-examples.py
64+
:start-after: start-insert-one
65+
:end-before: end-insert-one
66+
:language: python
67+
:copyable:
68+
69+
To learn more about the ``insert_one()`` method, see the :ref:`Insert Documents
70+
<pymongo-write-insert>` guide.
71+
72+
Insert Multiple
73+
---------------
74+
75+
.. literalinclude:: /includes/usage-examples/write-code-examples.py
76+
:start-after: start-insert-multiple
77+
:end-before: end-insert-multiple
78+
:language: python
79+
:copyable:
80+
81+
To learn more about the ``insert_many()`` method, see the :ref:`Insert Documents
82+
<pymongo-write-insert>` guide.
83+
84+
Update One
85+
----------
86+
87+
.. literalinclude:: /includes/usage-examples/write-code-examples.py
88+
:start-after: start-update-one
89+
:end-before: end-update-one
90+
:language: python
91+
:copyable:
92+
93+
To learn more about the ``update_one()`` method, see the
94+
:ref:`Update Documents <pymongo-write-update>` guide.
95+
96+
Update Multiple
97+
---------------
98+
99+
.. literalinclude:: /includes/usage-examples/write-code-examples.py
100+
:start-after: start-update-multiple
101+
:end-before: end-update-multiple
102+
:language: python
103+
:copyable:
104+
105+
To learn more about the ``update_many()`` method, see the
106+
:ref:`Update Documents <pymongo-write-update>` guide.
107+
108+
Replace One
109+
-----------
110+
111+
.. literalinclude:: /includes/usage-examples/write-code-examples.py
112+
:start-after: start-replace-one
113+
:end-before: end-replace-one
114+
:language: python
115+
:copyable:
116+
117+
To learn more about the ``replace_one()`` method, see the
118+
:ref:`Replace Documents <pymongo-write-replace>` guide.
119+
120+
Delete One
121+
----------
122+
123+
.. literalinclude:: /includes/usage-examples/write-code-examples.py
124+
:start-after: start-delete-one
125+
:end-before: end-delete-one
126+
:language: python
127+
:copyable:
128+
129+
To learn more about the ``delete_one()`` method, see the
130+
:ref:`Delete Documents <pymongo-write-delete>` guide.
131+
132+
Delete Multiple
133+
---------------
134+
135+
.. literalinclude:: /includes/usage-examples/write-code-examples.py
136+
:start-after: start-delete-multiple
137+
:end-before: end-delete-multiple
138+
:language: python
139+
:copyable:
140+
141+
To learn more about the ``delete_many()`` method, see the
142+
:ref:`Delete Documents <pymongo-write-delete>` guide.
143+
144+
Bulk Write
145+
----------
146+
147+
.. literalinclude:: /includes/usage-examples/write-code-examples.py
148+
:start-after: start-bulk-write
149+
:end-before: end-bulk-write
150+
:language: python
151+
:copyable:
152+
153+
To learn more about the ``bulk_write()`` method, see the
154+
:ref:`Bulk Write <pymongo-bulk-write>` guide.
155+
156+
Find One
157+
--------
158+
159+
.. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
160+
:start-after: start-find-one
161+
:end-before: end-find-one
162+
:language: python
163+
:copyable:
164+
165+
To learn more about the ``find_one()`` method, see :ref:`pymongo-retrieve-find-one` in
166+
the Retrieve Data guide.
167+
168+
Find Multiple
169+
-------------
170+
171+
.. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
172+
:start-after: start-find
173+
:end-before: end-find
174+
:language: python
175+
:copyable:
176+
177+
To learn more about the ``find()`` method, see :ref:`pymongo-retrieve-find-multiple` in
178+
the Retrieve Data guide.
179+
180+
Count Documents in a Collection
181+
-------------------------------
182+
183+
.. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
184+
:start-after: start-count-all
185+
:end-before: end-count-all
186+
:language: python
187+
:copyable:
188+
189+
To learn more about the ``count_documents()`` method, see the
190+
:ref:`pymongo-accurate-count` guide.
191+
192+
Count Documents Returned from a Query
193+
-------------------------------------
194+
195+
.. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
196+
:start-after: start-count-query
197+
:end-before: end-count-query
198+
:language: python
199+
:copyable:
200+
201+
To learn more about the ``count_documents()`` method, see the
202+
:ref:`pymongo-accurate-count` guide.
203+
204+
Estimated Document Count
205+
------------------------
206+
207+
.. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
208+
:start-after: start-estimated-count
209+
:end-before: end-estimated-count
210+
:language: python
211+
:copyable:
212+
213+
To learn more about the ``estimated_document_count()`` method, see the
214+
:ref:`pymongo-estimated-count` guide.
215+
216+
Retrieve Distinct Values
217+
------------------------
218+
219+
.. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
220+
:start-after: start-distinct
221+
:end-before: end-distinct
222+
:language: python
223+
:copyable:
224+
225+
To learn more about the ``distinct()`` method, see the
226+
:ref:`pymongo-distinct` guide.

0 commit comments

Comments
 (0)