PYTHON-911 - Add database.client alias
This commit is contained in:
parent
0f9ac50274
commit
c7f1546358
@ -118,6 +118,15 @@ class Database(common.BaseObject):
|
||||
"""
|
||||
return self.__connection
|
||||
|
||||
@property
|
||||
def client(self):
|
||||
"""The client instance for this :class:`Database`.
|
||||
|
||||
.. versionadded:: 2.9
|
||||
``client`` is an alias for ``connection``.
|
||||
"""
|
||||
return self.__connection
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""The name of this :class:`Database`.
|
||||
|
||||
@ -2420,6 +2420,9 @@ class TestCollection(unittest.TestCase):
|
||||
c.find_and_modify({'_id': 1}, {'$inc': {'i': 1}},
|
||||
new=True))
|
||||
|
||||
def test_client_alias(self):
|
||||
self.assertEqual(self.db.client, self.db.connection)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user