@@ -735,7 +735,7 @@ def __init__(
735735 self .__cursor_manager = None
736736 self .__kill_cursors_queue = []
737737
738- self ._event_listeners = options .pool_options .event_listeners
738+ self ._event_listeners = options .pool_options ._event_listeners
739739
740740 # Cache of existing indexes used by ensure_index ops.
741741 self .__index_cache = {}
@@ -749,7 +749,7 @@ def __init__(
749749 )
750750
751751 self .__all_credentials = {}
752- creds = options .credentials
752+ creds = options ._credentials
753753 if creds :
754754 self ._cache_credentials (creds .source , creds )
755755
@@ -1017,10 +1017,14 @@ def watch(
10171017
10181018 @property
10191019 def event_listeners (self ):
1020- """The event listeners registered for this client.
1020+ """**DEPRECATED**: The event listeners registered for this client.
10211021
10221022 See :mod:`~pymongo.monitoring` for details.
1023+
1024+ .. versionchanged:: 3.13
1025+ Deprecated. Use ``client.options.event_listeners`` instead.
10231026 """
1027+ warnings .warn ("event_listeners is deprecated. Use ``client.options.event_listeners`` instead." , DeprecationWarning , stacklevel = 2 )
10241028 return self ._event_listeners .event_listeners
10251029
10261030 @property
@@ -1132,7 +1136,7 @@ def is_mongos(self):
11321136
11331137 @property
11341138 def max_pool_size (self ):
1135- """The maximum allowable number of concurrent connections to each
1139+ """**DEPRECATED**: The maximum allowable number of concurrent connections to each
11361140 connected server. Requests to a server will block if there are
11371141 `maxPoolSize` outstanding connections to the requested server.
11381142 Defaults to 100. Cannot be 0.
@@ -1142,22 +1146,33 @@ def max_pool_size(self):
11421146 ``waitQueueTimeoutMS`` is set, a blocked operation will raise
11431147 :exc:`~pymongo.errors.ConnectionFailure` after a timeout.
11441148 By default ``waitQueueTimeoutMS`` is not set.
1149+
1150+ .. versionchanged:: 3.13
1151+ Deprecated. Use ``client.options.pool_options.max_pool_size`` instead.
11451152 """
1153+ warnings .warn ("max_pool_size is deprecated. Use ``client.options.pool_options.max_pool_size`` instead." , DeprecationWarning , stacklevel = 2 )
11461154 return self .__options .pool_options .max_pool_size
11471155
11481156 @property
11491157 def min_pool_size (self ):
1150- """The minimum required number of concurrent connections that the pool
1158+ """**DEPRECATED**: The minimum required number of concurrent connections that the pool
11511159 will maintain to each connected server. Default is 0.
1160+ .. versionchanged:: 3.13
1161+ Deprecated.
11521162 """
1163+ warnings .warn ("min_pool_size is deprecated. Use ``client.options.pool_options.min_pool_size`` instead." , DeprecationWarning , stacklevel = 2 )
11531164 return self .__options .pool_options .min_pool_size
11541165
11551166 @property
11561167 def max_idle_time_ms (self ):
1157- """The maximum number of milliseconds that a connection can remain
1168+ """**DEPRECATED**: The maximum number of milliseconds that a connection can remain
11581169 idle in the pool before being removed and replaced. Defaults to
11591170 `None` (no limit).
1171+
1172+ .. versionchanged:: 3.13
1173+ Deprecated. Use ``client.options.pool_options.max_idle_time_seconds`` instead.
11601174 """
1175+ warnings .warn ("max_idle_time_ms is deprecated. Use ``client.options.pool_options.max_idle_time_seconds`` instead." , DeprecationWarning , stacklevel = 2 )
11611176 seconds = self .__options .pool_options .max_idle_time_seconds
11621177 if seconds is None :
11631178 return None
@@ -1177,6 +1192,17 @@ def nodes(self):
11771192 description = self ._topology .description
11781193 return frozenset (s .address for s in description .known_servers )
11791194
1195+ @property
1196+ def options (self ):
1197+ """The configuration options for this client.
1198+
1199+ :Returns:
1200+ An instance of :class:`~pymongo.client_options.ClientOptions`.
1201+
1202+ .. versionadded:: 3.13
1203+ """
1204+ return self .__options
1205+
11801206 @property
11811207 def max_bson_size (self ):
11821208 """The largest BSON object the connected server accepts in bytes.
@@ -1212,22 +1238,42 @@ def max_write_batch_size(self):
12121238
12131239 @property
12141240 def local_threshold_ms (self ):
1215- """The local threshold for this instance."""
1241+ """**DEPRECATED**: The local threshold for this instance.
1242+
1243+ .. versionchanged:: 3.13
1244+ Deprecated. Use ``client.options.local_threshold_ms`` instead.
1245+ """
1246+ warnings .warn ("local_threshold_ms is deprecated. Use ``client.options.local_threshold_ms`` instead." , DeprecationWarning , stacklevel = 2 )
12161247 return self .__options .local_threshold_ms
12171248
12181249 @property
12191250 def server_selection_timeout (self ):
1220- """The server selection timeout for this instance in seconds."""
1251+ """**DEPRECATED**: The server selection timeout for this instance in seconds.
1252+
1253+ .. versionchanged:: 3.13
1254+ Deprecated. Use ``client.options.server_selection_timeout`` instead.
1255+ """
1256+ warnings .warn ("server_selection_timeout is deprecated. Use ``client.options.server_selection_timeout`` instead." , DeprecationWarning , stacklevel = 2 )
12211257 return self .__options .server_selection_timeout
12221258
12231259 @property
12241260 def retry_writes (self ):
1225- """If this instance should retry supported write operations."""
1261+ """**DEPRECATED**: If this instance should retry supported write operations.
1262+
1263+ .. versionchanged:: 3.13
1264+ Deprecated. Use ``client.options.retry_writes`` instead.
1265+ """
1266+ warnings .warn ("retry_writes is deprecated. Use ``client.options.retry_writes`` instead." , DeprecationWarning , stacklevel = 2 )
12261267 return self .__options .retry_writes
12271268
12281269 @property
12291270 def retry_reads (self ):
1230- """If this instance should retry supported write operations."""
1271+ """**DEPRECATED**: If this instance should retry supported write operations.
1272+
1273+ .. versionchanged:: 3.13
1274+ Deprecated. Use ``client.options.retry_reads`` instead.
1275+ """
1276+ warnings .warn ("retry_reads is deprecated. Use ``client.options.retry_reads`` instead." , DeprecationWarning , stacklevel = 2 )
12311277 return self .__options .retry_reads
12321278
12331279 def _is_writable (self ):
@@ -1469,7 +1515,7 @@ def _retry_with_session(self, retryable, func, session, bulk):
14691515
14701516 Re-raises any exception thrown by func().
14711517 """
1472- retryable = retryable and self .retry_writes and session and not session .in_transaction
1518+ retryable = retryable and self .options . retry_writes and session and not session .in_transaction
14731519 return self ._retry_internal (retryable , func , session , bulk )
14741520
14751521 def _retry_internal (self , retryable , func , session , bulk ):
@@ -1538,7 +1584,7 @@ def _retryable_read(self, func, read_pref, session, address=None, retryable=True
15381584
15391585 Re-raises any exception thrown by func().
15401586 """
1541- retryable = retryable and self .retry_reads and not (session and session .in_transaction )
1587+ retryable = retryable and self .options . retry_reads and not (session and session .in_transaction )
15421588 last_error = None
15431589 retrying = False
15441590
0 commit comments