Commit Graph

81 Commits

Author SHA1 Message Date
Steven Silvester
a0fe7c03af
PYTHON-3120 Set up flake8 linting (#868) 2022-02-17 06:44:08 -06:00
Steven Silvester
5578999a90
PYTHON-1834 Use a code formatter (#852) 2022-02-09 06:44:28 -06:00
Steven Silvester
dd6c140d43
PYTHON-3060 Add typings to pymongo package (#831) 2022-02-02 21:12:36 -06:00
Shane Harvey
71a1656be0
PYTHON-2038 Remove pymongo.errors.CertificateError (#705) 2021-08-12 09:29:30 -07:00
Shane Harvey
e3a61b9ff7
PYTHON-1840 Remove waitQueueMultiple and ExceededMaxWaiters (#699) 2021-08-09 10:53:28 -07:00
Prashant Mital
0209e4a4a4
PYTHON-2571 Remove NotMasterError (#688) 2021-07-28 16:01:32 -07:00
Bernie Hackett
a94504bde9 PYTHON-2726 Document read preference quirks 2021-06-28 13:08:07 -07:00
Prashant Mital
ff6ca53328
PYTHON-2572 Introduce NotPrimaryError and deprecate NotMasterError (#646) 2021-06-22 13:24:07 -07:00
Bernie Hackett
6c2d629006 PYTHON-2133 Remove Py2 compatibility from pymongo 2021-01-19 21:15:20 -08:00
Pascal Corpet
86d58113e5
PYTHON-2438 Fix str representation of BulkWriteError (#522) 2020-11-23 09:46:33 -08:00
Shane Harvey
30523d282c
PYTHON-2415 Fix pickle support for BulkWriteError exceptions (#514) 2020-11-12 11:04:55 -08:00
Julius Park
a075eb798f
PYTHON-1787: fix NotMasterError no attribute error (#450) 2020-07-02 13:53:08 -04:00
Prashant Mital
e23d019f9e
remove unnecessary changes 2020-07-01 17:24:41 -07:00
Prashant Mital
8e3fd0040e
cruft removal 2 2020-07-01 16:49:36 -07:00
Prashant Mital
14cecab393
cleanup cruft 2020-07-01 16:47:36 -07:00
Prashant Mital
956ce3d4b0
Incorporate review changes 2020-07-01 16:47:33 -07:00
Prashant Mital
9fc7ed1e11
PYTHON-2143 Use an allow-list to determine resumable change stream errors 2020-07-01 16:43:27 -07:00
Shane Harvey
1f4123e4bf PYTHON-2123 Streaming heartbeat protocol
MongoClient now requires 2 connections and 2 threads to each MongoDB 4.4+ server.
With one connection, the server streams (or pushes) updated heartbeat info.
With the other connection, the client periodically pings the server to
establish an accurate round-trip time (RTT). This change optimizes the
discovery of server state changes such as replica set elections.

Additional changes:
- Mark server Unknown before retrying isMaster check.
- Always reset the pool _after_ marking the server unknown.
- Configure fail point before creating the client in test SpecRunner.
- Unfreeze with replSetFreeze:0 to ensure a speedy elections in test suite.
2020-07-01 14:49:46 -07:00
Julius Park
67a23429ba
PYTHON-1787: add details to OperationFailure exception and NotMasterError (#448)
PYTHON-1787-add details to OperationFailure and NotMasterError by adding a __repr__ function

https://jira.mongodb.org/browse/PYTHON-1787
2020-06-30 12:30:28 -04:00
Shane Harvey
45a7963aac PYTHON-2082 Retryable writes use the RetryableWriteError label
Use retryable write logic for transaction commit/abort.
Do not assign the TransientTransactionError label to errors outside a
transaction.
2020-05-19 10:49:28 -07:00
Bernie Hackett
5df94d08f0 PYTHON-2040 PyOpenSSL support 2020-02-06 18:03:21 -08:00
Shane Harvey
e627321c2e PYTHON-1966 Fix unicode(PyMongoError) on Python 2 2019-11-22 15:17:56 -08:00
Shane Harvey
0a1d77751f PYTHON-1942 Implement prose tests for External Key Vault 2019-08-08 20:52:28 -07:00
Shane Harvey
e6eecb06d1 PYTHON-1884 Implement auto encryption spec tests
Skip test for symbol type which pymongo converts to string.
Fix {} comparison with RawBSONDocument in command events.
Add support for $$type assertions.
Nicer message in check_events.
Support errorContains with empty string.
Move custom data files to custom/.
2019-08-06 16:17:39 -07:00
Shane Harvey
f588412b67 PYTHON-1842 Implement Connection Monitoring and Pooling spec 2019-06-13 15:50:49 -07:00
Shane Harvey
e7114087c7 PYTHON-1682 UTF-8 encode unicode error messages on Python 2 2018-11-13 17:43:57 -08:00
Shane Harvey
b5e9007af0 PYTHON-1508 PYTHON-1589 Expand where unknown commit label is raised
Remove has_label api.
Bump required server version for transactions.
2018-06-15 11:29:11 -07:00
Shane Harvey
e4317d286b PYTHON-1508 Retryable commit/abort, has_error_label api
Retryable commitTransaction/abortTransaction.
Retry writes after certain writeConcernErrors.
Add has_error_label api.
Update unacknowledged write concern error messge.
Resync transaction tests and update test runner.
2018-06-07 14:39:52 -07:00
Shane Harvey
ffcd66561f PYTHON-1508 Add has_label to temporary transaction errors 2018-04-17 16:56:01 -07:00
Bernie Hackett
507f954ed4 Update copyright dates 2017-12-01 17:23:39 -08:00
Bernie Hackett
740fc3c07a PYTHON-1033, PYTHON-1034 - Make protocol asserts exceptions
This change introduces a new exception, pymongo.errors.ProtocolError,
and uses it in place of asserts related to the wire protocol.
2016-05-19 17:18:00 -07:00
Bernie Hackett
fa4a6a39d3 PYTHON-952 - Query and getMore monitoring
This commit adds support for monitoring queries and getMore
operations, including getMore operations for command cursors
(e.g. aggregate cursor getMore). It also fixes a bug in duration
calculation.
2015-08-11 12:19:28 -07:00
Bernie Hackett
aec685b374 Fix up copyright dates. 2015-03-25 11:55:02 -07:00
aherlihy
fa1466179f PYTHON-813 Added support for serverSelectionTimeoutMS 2015-03-09 12:38:24 -07:00
Bernie Hackett
4fd6f8a0b1 PYTHON-854 max_pool_size -> maxPoolSize
With this change the max_pool_size named parameter to
MongoClient is removed. It is replaced by the maxPoolSize
MongoDB URI option, which can be passed in a URI, or as a
keyword argument to MongoClient.
2015-03-09 10:08:13 -07:00
Bernie Hackett
c800cd18ad PYTHON-837 - Implement CRUD spec exception hierarchy. 2015-02-24 13:49:39 -08:00
A. Jesse Jiryu Davis
1447ad1257 Remove pymongo.errors.UnsupportedOption. 2014-10-31 16:42:11 -04:00
A. Jesse Jiryu Davis
936ee264cb PEP 257. 2014-10-31 14:15:24 -04:00
A. Jesse Jiryu Davis
08dccbba46 Remove ancient version annotations.
Delete "versionchanged" and "versionadded" directives that predate 2.0.
2014-10-31 14:15:24 -04:00
A. Jesse Jiryu Davis
735a1247ca PYTHON-525 Deprecate MongoReplicaSetClient.
MongoClient now supports all MongoReplicaSetClient's features.
Fix bugs and add features in the new MongoClient to bring it up
to spec. MongoReplicaSetClient is now a deprecated stub that
subclasses MongoClient.

Introduce new errors, NetworkTimeout and NotMasterError, to
communicate events that MongoClient must handle specially.
2014-09-16 15:33:19 -04:00
Bernie Hackett
e3c809bd02 Gracefully kill cursor on capped rollover PYTHON-637
This change does a few things:

- Raises a new exception for CursorNotFound, inheriting from
OperationFailure so we don't break existing code.
- Catches the exception in cursor.Cursor and command_cursor.CommandCursor,
setting __killed to True.
- If the cursor is not tailable, re-raises the exception. This makes it
easier to deal with capped collection rollover when iterating a
tailable cursor.
2014-02-12 08:33:13 -08:00
A. Jesse Jiryu Davis
2fa1750b07 Update copyright notices and company name. 2014-01-31 09:36:46 -05:00
Bernie Hackett
ee9ecd05ee Introduce DocumentTooLarge exception PYTHON-630
The idea here is to unify the handling of oversize documents when using
the bulk API in MongoDB 2.6 and previous versions. This also means that
using bulk Collection.insert against legacy servers will attempt to insert
all documents previous to the oversize document before raising.
2014-01-29 12:55:49 -08:00
Bernie Hackett
36b86007e5 OperationFailure error_document -> details PYTHON-576 2014-01-24 11:10:02 -08:00
Bernie Hackett
01f6361929 Fluent API for bulk write operations PYTHON-630 2014-01-21 11:47:09 -08:00
Bernie Hackett
1ee7f930fc Add error_document to OperationFailure PYTHON-576
This change adds an error_document attribute to
OperationFailure and subclasses. The error_document
attr will be the complete error document returned by
the server, when available. The error document may
include valuable information other than just the error
message, particularly when connected to mongos, which
may return one or more error subdocuments representing
errors on multiple shards.
2013-10-21 18:44:25 -07:00
Bernie Hackett
9386efe77f Raise WTimeoutError for wtimeout error PYTHON-575
PyMongo defines a TimeoutError exception, added in PyMongo
1.8, that is supposed to be raised if the server returns
a wtimeout error for inserts, updates, or removes. This error
has not actually been raised by the driver since MongoDB 1.8,
which changed how wtimeout is reported by the server.

This commit fixes the problem by raising a new exception,
WTimeoutError, instead of OperationFailure when the server
returns wtimeout. WTimeoutError is meant to distinguish this
particular error from other "timeout" errors handled in the
driver. It inherits from (now deprecated) TimeoutError to support
applications and libraries that already catch TimeoutError.

PYTHON-576 will add the server error document to OperationFailure
and subclasses (e.g. WTimeoutError), which can be used to check
return values like 'n', 'updatedExisting', and 'writtenTo', even
though wtimeout error occured.
2013-10-21 09:03:56 -07:00
hawka
5b1e852e4b PYTHON-550 changes to support maxTimeMS 2013-09-18 11:19:11 -04:00
A. Jesse Jiryu Davis
5a88c6c2f4 Update docs for new pool options. PYTHON-436 2013-08-16 09:43:50 -04:00
Ross Lawley
48046b2efd SSL certificate verification PYTHON-466 2013-02-19 15:45:57 +00:00