Skip to content

Commit 9ec1845

Browse files
committed
Add size properties to MasterSlaveConnection PYTHON-414
Needed for batch inserts.
1 parent 3afd684 commit 9ec1845

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pymongo/master_slave_connection.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,25 @@ def set_document_class(self, klass):
117117
def tz_aware(self):
118118
return self.__tz_aware
119119

120+
@property
121+
def max_bson_size(self):
122+
"""Return the maximum size BSON object the connected master
123+
accepts in bytes. Defaults to 4MB in server < 1.7.4.
124+
125+
.. versionadded:: 2.6
126+
"""
127+
return self.master.max_bson_size
128+
129+
@property
130+
def max_message_size(self):
131+
"""Return the maximum message size the connected master
132+
accepts in bytes.
133+
134+
.. versionadded:: 2.6
135+
"""
136+
return self.master.max_message_size
137+
138+
120139
def disconnect(self):
121140
"""Disconnect from MongoDB.
122141

0 commit comments

Comments
 (0)