@@ -107,10 +107,10 @@ The following example reads the sample BSON document from ``file.bson``:
107
107
.. input::
108
108
:language: python
109
109
110
- with open("file.bson", "rb") as file:
111
- data = file.read()
112
- document = bson.decode(data)
113
- print(document)
110
+ with open("file.bson", "rb") as file:
111
+ data = file.read()
112
+ document = bson.decode(data)
113
+ print(document)
114
114
115
115
.. output::
116
116
:visible: false
@@ -140,53 +140,25 @@ constructor to ``RawBSONDocument``.
140
140
first convert it to a {+language+} dictionary.
141
141
142
142
The following example configures a ``MongoClient`` object to use ``RawBSONDocument`` objects
143
- to model the collection, then retrieves the sample document from the preceding examples.
144
- Select the :guilabel:`Synchronous` or :guilabel:`Asynchronous` tab to see the corresponding
145
- code.
143
+ to model the collection, then retrieves the sample document from the preceding examples:
146
144
147
- .. tabs::
148
-
149
- .. tab:: Synchronous
150
- :tabid: sync
151
-
152
- .. io-code-block::
153
- :copyable: true
154
-
155
- .. input::
156
- :language: python
157
-
158
- from bson.raw_bson import RawBSONDocument
159
-
160
- client = pymongo.MongoClient("<connection URI>", document_class=RawBSONDocument)
161
- collection = client.sample_restaurants.restaurants
162
- raw_doc = collection.find_one({"name": "Mongo's Pizza"})
163
- print(type(raw_doc))
164
-
165
- .. output::
166
- :visible: false
167
-
168
- <class 'bson.raw_bson.RawBSONDocument'>
169
-
170
- .. tab:: Asynchronous
171
- :tabid: async
172
-
173
- .. io-code-block::
174
- :copyable: true
145
+ .. io-code-block::
146
+ :copyable: true
175
147
176
- .. input::
177
- :language: python
178
-
179
- from bson.raw_bson import RawBSONDocument
148
+ .. input::
149
+ :language: python
150
+
151
+ from bson.raw_bson import RawBSONDocument
180
152
181
- client = pymongo.AsyncMongoClient ("<connection URI>", document_class=RawBSONDocument)
182
- collection = client.sample_restaurants.restaurants
183
- raw_doc = await collection.find_one({"name": "Mongo's Pizza"})
184
- print(type(raw_doc))
153
+ client = pymongo.MongoClient ("<connection URI>", document_class=RawBSONDocument)
154
+ collection = client.sample_restaurants.restaurants
155
+ raw_doc = collection.find_one({"name": "Mongo's Pizza"})
156
+ print(type(raw_doc))
185
157
186
- .. output::
187
- :visible: false
158
+ .. output::
159
+ :visible: false
188
160
189
- <class 'bson.raw_bson.RawBSONDocument'>
161
+ <class 'bson.raw_bson.RawBSONDocument'>
190
162
191
163
API Documentation
192
164
-----------------
0 commit comments