@@ -1817,8 +1817,9 @@ def drop_database(self, name_or_database, session=None):
18171817                parse_write_concern_error = True ,
18181818                session = session )
18191819
1820-     def  get_default_database (self ):
1821-         """DEPRECATED - Get the database named in the MongoDB connection URI. 
1820+     def  get_default_database (self , default = None , codec_options = None ,
1821+             read_preference = None , write_concern = None , read_concern = None ):
1822+         """Get the database named in the MongoDB connection URI. 
18221823
18231824        >>> uri = 'mongodb://host/my_database' 
18241825        >>> client = MongoClient(uri) 
@@ -1830,15 +1831,41 @@ def get_default_database(self):
18301831        Useful in scripts where you want to choose which database to use 
18311832        based only on the URI in a configuration file. 
18321833
1834+         :Parameters: 
1835+           - `default` (optional): the database name to use if no database name 
1836+             was provided in the URI. 
1837+           - `codec_options` (optional): An instance of 
1838+             :class:`~bson.codec_options.CodecOptions`. If ``None`` (the 
1839+             default) the :attr:`codec_options` of this :class:`MongoClient` is 
1840+             used. 
1841+           - `read_preference` (optional): The read preference to use. If 
1842+             ``None`` (the default) the :attr:`read_preference` of this 
1843+             :class:`MongoClient` is used. See :mod:`~pymongo.read_preferences` 
1844+             for options. 
1845+           - `write_concern` (optional): An instance of 
1846+             :class:`~pymongo.write_concern.WriteConcern`. If ``None`` (the 
1847+             default) the :attr:`write_concern` of this :class:`MongoClient` is 
1848+             used. 
1849+           - `read_concern` (optional): An instance of 
1850+             :class:`~pymongo.read_concern.ReadConcern`. If ``None`` (the 
1851+             default) the :attr:`read_concern` of this :class:`MongoClient` is 
1852+             used. 
1853+ 
1854+         .. versionchanged:: 3.8 
1855+            Undeprecated. Added the ``default``, ``codec_options``, 
1856+            ``read_preference``, ``write_concern`` and ``read_concern`` 
1857+            parameters. 
1858+ 
18331859        .. versionchanged:: 3.5 
18341860           Deprecated, use :meth:`get_database` instead. 
18351861        """ 
1836-         warnings .warn ("get_default_database is deprecated. Use get_database " 
1837-                       "instead." , DeprecationWarning , stacklevel = 2 )
1838-         if  self .__default_database_name  is  None :
1839-             raise  ConfigurationError ('No default database defined' )
1862+         if  self .__default_database_name  is  None  and  default  is  None :
1863+             raise  ConfigurationError (
1864+                 'No default database name defined or provided.' )
18401865
1841-         return  self [self .__default_database_name ]
1866+         return  database .Database (
1867+             self , self .__default_database_name  or  default , codec_options ,
1868+             read_preference , write_concern , read_concern )
18421869
18431870    def  get_database (self , name = None , codec_options = None , read_preference = None ,
18441871                     write_concern = None , read_concern = None ):
0 commit comments