Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TxMongo should correctly reject too large documents #208

Open
IlyaSkriblovsky opened this issue May 2, 2017 · 2 comments
Open

TxMongo should correctly reject too large documents #208

IlyaSkriblovsky opened this issue May 2, 2017 · 2 comments

Comments

@IlyaSkriblovsky
Copy link
Contributor

PyMongo raises DocumentTooLarge in all situations when document that is larger than max_bson_size is sent to DB.

TxMongo fails with two different invalid errors:

  1. when insert() is called with too large document, it fails with OperationFailure
  2. when insert_one() is called, it fails with AutoReconnect, 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:

  1. Database.command (covers all new-style *_one/_many methods)
  2. Old-style insert(), update(), etc.
  3. Bulk ops
@psi29a
Copy link
Contributor

psi29a commented May 2, 2017

Nice find and I agree that the check on the TxMongo side would reduce overhead on MongoDB itself and save us extra calls.

@IlyaSkriblovsky
Copy link
Contributor Author

IlyaSkriblovsky commented May 2, 2017

reduce overhead on MongoDB itself and save us extra calls

and extra reconnects in case of new-style insert_one() :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants