@@ -50,81 +50,182 @@ the relevant values for your MongoDB deployment.
5050
5151.. include:: /includes/usage-examples/sample-app-intro.rst
5252
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
5875
5976Find One
6077--------
6178
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
6794
6895To learn more about the ``find_one()`` method, see :ref:`pymongo-retrieve-find-one` in
6996the Retrieve Data guide.
7097
7198Find Multiple
7299-------------
73100
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
79116
80117To learn more about the ``find()`` method, see :ref:`pymongo-retrieve-find-multiple` in
81118the Retrieve Data guide.
82119
83120Count Documents in a Collection
84121-------------------------------
85122
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
91138
92139To learn more about the ``count_documents()`` method, see the
93140:ref:`pymongo-accurate-count` guide.
94141
95142Count Documents Returned from a Query
96143-------------------------------------
97144
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
103160
104161To learn more about the ``count_documents()`` method, see the
105162:ref:`pymongo-accurate-count` guide.
106163
107164Estimated Document Count
108165------------------------
109166
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
115182
116183To learn more about the ``estimated_document_count()`` method, see the
117184:ref:`pymongo-estimated-count` guide.
118185
119186Retrieve Distinct Values
120187------------------------
121188
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
127204
128205To learn more about the ``distinct()`` method, see the
129206:ref:`pymongo-distinct` guide.
130207
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