@@ -132,11 +132,13 @@ constructor accepts. All parameters are optional.
132
132
133
133
* - ``document_class``
134
134
- The default class that the client uses to decode BSON documents returned by queries.
135
- This parameter supports the following types:
135
+ This parameter accepts the following types:
136
136
137
- - ``bson.raw_bson.RawBSONDocument``.
137
+ - ``bson.raw_bson.RawBSONDocument``. To learn more about the ``RawBSONDocument`` class,
138
+ see :ref:`pymongo-bson-raw`.
139
+
138
140
- A subclass of the ``collections.abc.Mapping`` type, such as ``bson.son.SON``.
139
- If you specify ``bson.son.SON`` as the document class, you must also specify types
141
+ If you specify ``bson.son.SON`` as the document class, you may also specify types
140
142
for the key and value, as shown in the following example:
141
143
142
144
.. code-block:: python
@@ -265,6 +267,17 @@ The following example shows how to include this data type in your type annotatio
265
267
from typing import Any, Dict
266
268
client: MongoClient[Dict[str, Any]] = MongoClient()
267
269
270
+ If all the documents that you are working with correspond to a single custom type, you
271
+ can specify the custom type as a type hint for your ``MongoClient`` object. This
272
+ provides more accurate type information than the generic ``Dict[str, Any]`` type.
273
+
274
+ The following example shows how to specify the ``Movie`` type as a type hint for a
275
+ ``MongoClient`` object:
276
+
277
+ .. code-block:: python
278
+
279
+ client: MongoClient[Movie] = MongoClient()
280
+
268
281
Troubleshooting
269
282
---------------
270
283
0 commit comments