@@ -405,6 +405,42 @@ can be replaced by this with PyMongo 2.9 or later:
405405MongoClient
406406-----------
407407
408+ MongoClient connects asynchronously
409+ ...................................
410+
411+ In PyMongo 3, the :class: `~pymongo.mongo_client.MongoClient ` constructor no
412+ longer blocks while connecting to the server or servers, and it no longer
413+ raises :exc: `~pymongo.errors.ConnectionFailure ` if they are unavailable, nor
414+ :exc: `~pymongo.errors.ConfigurationError ` if the user’s credentials are wrong.
415+ Instead, the constructor returns immediately and launches the connection
416+ process on background threads. The `connect ` option is added to control whether
417+ these threads are started immediately, or when the client is first used.
418+
419+ For consistent behavior in PyMongo 2.x and PyMongo 3.x, code like this::
420+
421+ >>> from pymongo.errors import ConnectionFailure
422+ >>> try:
423+ ... client = MongoClient()
424+ ... except ConnectionFailure:
425+ ... print("Server not available")
426+ >>>
427+
428+ can be changed to this with PyMongo 2.9 or later:
429+
430+ .. doctest ::
431+
432+ >>> from pymongo.errors import ConnectionFailure
433+ >>> client = MongoClient(connect = False )
434+ >>> try :
435+ ... result = client.admin.command(" ismaster" )
436+ ... except ConnectionFailure:
437+ ... print (" Server not available" )
438+ >>>
439+
440+ Any operation can be used to determine if the server is available. We choose
441+ the "ismaster" command here because it is cheap and does not require auth, so
442+ it is a simple way to check whether the server is available.
443+
408444The max_pool_size parameter is removed
409445......................................
410446
0 commit comments