Skip to content

Commit f98c0b9

Browse files
committed
PYTHON-2393 Document unicode error handler for MongoClient
(cherry picked from commit dde28d7)
1 parent 1a60c03 commit f98c0b9

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

pymongo/mongo_client.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,25 +197,25 @@ def __init__(
197197
- `port` (optional): port number on which to connect
198198
- `document_class` (optional): default class to use for
199199
documents returned from queries on this client
200-
- `type_registry` (optional): instance of
201-
:class:`~bson.codec_options.TypeRegistry` to enable encoding
202-
and decoding of custom types.
203200
- `tz_aware` (optional): if ``True``,
204201
:class:`~datetime.datetime` instances returned as values
205202
in a document by this :class:`MongoClient` will be timezone
206203
aware (otherwise they will be naive)
207204
- `connect` (optional): if ``True`` (the default), immediately
208205
begin connecting to MongoDB in the background. Otherwise connect
209206
on the first operation.
207+
- `type_registry` (optional): instance of
208+
:class:`~bson.codec_options.TypeRegistry` to enable encoding
209+
and decoding of custom types.
210+
211+
| **Other optional parameters can be passed as keyword arguments:**
212+
210213
- `directConnection` (optional): if ``True``, forces this client to
211214
connect directly to the specified MongoDB host as a standalone.
212215
If ``false``, the client connects to the entire replica set of
213216
which the given MongoDB host(s) is a part. If this is ``True``
214217
and a mongodb+srv:// URI or a URI containing multiple seeds is
215218
provided, an exception will be raised.
216-
217-
| **Other optional parameters can be passed as keyword arguments:**
218-
219219
- `maxPoolSize` (optional): The maximum allowable number of
220220
concurrent connections to each connected server. Requests to a
221221
server will block if there are `maxPoolSize` outstanding
@@ -346,6 +346,10 @@ def __init__(
346346
`csharpLegacy`, `standard` and `unspecified`. New applications
347347
should consider setting this to `standard` for cross language
348348
compatibility. See :ref:`handling-uuid-data-example` for details.
349+
- `unicode_decode_error_handler`: The error handler to apply when
350+
a Unicode-related error occurs during BSON decoding that would
351+
otherwise raise :exc:`UnicodeDecodeError`. Valid options include
352+
'strict', 'replace', and 'ignore'. Defaults to 'strict'.
349353
350354
| **Write Concern options:**
351355
| (Only set if passed. No default values.)

0 commit comments

Comments
 (0)