Open IlyaSkriblovsky opened 7 years ago
Nice find and I agree that the check on the TxMongo side would reduce overhead on MongoDB itself and save us extra calls.
reduce overhead on MongoDB itself and save us extra calls
and extra reconnects in case of new-style insert_one()
:)
PyMongo raises
DocumentTooLarge
in all situations when document that is larger thanmax_bson_size
is sent to DB.TxMongo fails with two different invalid errors:
insert()
is called with too large document, it fails withOperationFailure
insert_one()
is called, it fails withAutoReconnect
, probably because MongoDB closes the connection when TxMongo tries to send too large document with new-style command-based API.Size checking should be done on TxMongo's size at least in following places: