@@ -50,81 +50,182 @@ the relevant values for your MongoDB deployment.
50
50
51
51
.. include:: /includes/usage-examples/sample-app-intro.rst
52
52
53
- .. literalinclude:: /includes/usage-examples/crud-sample-app.py
54
- :language: python
55
- :copyable:
56
- :linenos:
57
- :emphasize-lines: 11-13
53
+ Select the :guilabel:`Synchronous` or :guilabel:`Asynchronous` tab to see the corresponding
54
+ code:
55
+
56
+ .. tabs::
57
+
58
+ .. tab:: Synchronous
59
+ :tabid: sync
60
+
61
+ .. literalinclude:: /includes/usage-examples/crud-sample-app.py
62
+ :language: python
63
+ :copyable:
64
+ :linenos:
65
+ :emphasize-lines: 11-13
66
+
67
+ .. tab:: Asynchronous
68
+ :tabid: async
69
+
70
+ .. literalinclude:: /includes/usage-examples/crud-sample-app-async.py
71
+ :language: python
72
+ :copyable:
73
+ :linenos:
74
+ :emphasize-lines: 13-15
58
75
59
76
Find One
60
77
--------
61
78
62
- .. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
63
- :start-after: start-find-one
64
- :end-before: end-find-one
65
- :language: python
66
- :copyable:
79
+ .. tabs::
80
+
81
+ .. tab:: Synchronous
82
+ :tabid: sync
83
+
84
+ .. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
85
+ :start-after: start-find-one
86
+ :end-before: end-find-one
87
+
88
+ .. tab:: Asynchronous
89
+ :tabid: async
90
+
91
+ .. literalinclude:: /includes/usage-examples/retrieve-code-examples-async.py
92
+ :start-after: start-find-one
93
+ :end-before: end-find-one
67
94
68
95
To learn more about the ``find_one()`` method, see :ref:`pymongo-retrieve-find-one` in
69
96
the Retrieve Data guide.
70
97
71
98
Find Multiple
72
99
-------------
73
100
74
- .. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
75
- :start-after: start-find
76
- :end-before: end-find
77
- :language: python
78
- :copyable:
101
+ .. tabs::
102
+
103
+ .. tab:: Synchronous
104
+ :tabid: sync
105
+
106
+ .. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
107
+ :start-after: start-find
108
+ :end-before: end-find
109
+
110
+ .. tab:: Asynchronous
111
+ :tabid: async
112
+
113
+ .. literalinclude:: /includes/usage-examples/retrieve-code-examples-async.py
114
+ :start-after: start-find
115
+ :end-before: end-find
79
116
80
117
To learn more about the ``find()`` method, see :ref:`pymongo-retrieve-find-multiple` in
81
118
the Retrieve Data guide.
82
119
83
120
Count Documents in a Collection
84
121
-------------------------------
85
122
86
- .. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
87
- :start-after: start-count-all
88
- :end-before: end-count-all
89
- :language: python
90
- :copyable:
123
+ .. tabs::
124
+
125
+ .. tab:: Synchronous
126
+ :tabid: sync
127
+
128
+ .. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
129
+ :start-after: start-count-all
130
+ :end-before: end-count-all
131
+
132
+ .. tab:: Asynchronous
133
+ :tabid: async
134
+
135
+ .. literalinclude:: /includes/usage-examples/retrieve-code-examples-async.py
136
+ :start-after: start-count-all
137
+ :end-before: end-count-all
91
138
92
139
To learn more about the ``count_documents()`` method, see the
93
140
:ref:`pymongo-accurate-count` guide.
94
141
95
142
Count Documents Returned from a Query
96
143
-------------------------------------
97
144
98
- .. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
99
- :start-after: start-count-query
100
- :end-before: end-count-query
101
- :language: python
102
- :copyable:
145
+ .. tabs::
146
+
147
+ .. tab:: Synchronous
148
+ :tabid: sync
149
+
150
+ .. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
151
+ :start-after: start-count-query
152
+ :end-before: end-count-query
153
+
154
+ .. tab:: Asynchronous
155
+ :tabid: async
156
+
157
+ .. literalinclude:: /includes/usage-examples/retrieve-code-examples-async.py
158
+ :start-after: start-count-query
159
+ :end-before: end-count-query
103
160
104
161
To learn more about the ``count_documents()`` method, see the
105
162
:ref:`pymongo-accurate-count` guide.
106
163
107
164
Estimated Document Count
108
165
------------------------
109
166
110
- .. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
111
- :start-after: start-estimated-count
112
- :end-before: end-estimated-count
113
- :language: python
114
- :copyable:
167
+ .. tabs::
168
+
169
+ .. tab:: Synchronous
170
+ :tabid: sync
171
+
172
+ .. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
173
+ :start-after: start-estimated-count
174
+ :end-before: end-estimated-count
175
+
176
+ .. tab:: Asynchronous
177
+ :tabid: async
178
+
179
+ .. literalinclude:: /includes/usage-examples/retrieve-code-examples-async.py
180
+ :start-after: start-estimated-count
181
+ :end-before: end-estimated-count
115
182
116
183
To learn more about the ``estimated_document_count()`` method, see the
117
184
:ref:`pymongo-estimated-count` guide.
118
185
119
186
Retrieve Distinct Values
120
187
------------------------
121
188
122
- .. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
123
- :start-after: start-distinct
124
- :end-before: end-distinct
125
- :language: python
126
- :copyable:
189
+ .. tabs::
190
+
191
+ .. tab:: Synchronous
192
+ :tabid: sync
193
+
194
+ .. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
195
+ :start-after: start-distinct
196
+ :end-before: end-distinct
197
+
198
+ .. tab:: Asynchronous
199
+ :tabid: async
200
+
201
+ .. literalinclude:: /includes/usage-examples/retrieve-code-examples-async.py
202
+ :start-after: start-distinct
203
+ :end-before: end-distinct
127
204
128
205
To learn more about the ``distinct()`` method, see the
129
206
:ref:`pymongo-distinct` guide.
130
207
208
+ <<<<<<< HEAD:source/crud/query.txt
209
+ =======
210
+ Monitor Data Changes
211
+ --------------------
212
+
213
+ .. tabs::
214
+
215
+ .. tab:: Synchronous
216
+ :tabid: sync
217
+
218
+ .. literalinclude:: /includes/usage-examples/retrieve-code-examples.py
219
+ :start-after: start-watch-for-changes
220
+ :end-before: end-watch-for-changes
221
+
222
+ .. tab:: Asynchronous
223
+ :tabid: async
224
+
225
+ .. literalinclude:: /includes/usage-examples/retrieve-code-examples-async.py
226
+ :start-after: start-watch-for-changes
227
+ :end-before: end-watch-for-changes
228
+
229
+ To learn more about the ``watch()`` method, see the
230
+ :ref:`pymongo-change-streams` guide.
231
+ >>>>>>> 5387503 (DOCSP-48163: Add async examples for Read pages):source/read.txt
0 commit comments