Commit Graph

41 Commits

Author SHA1 Message Date
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
A. Jesse Jiryu Davis
f275b2291a Implement read preferences for distributing reads among replica set members PYTHON-367
Replace the 'mongo' dict with a Member object everywhere in ReplicaSetConnection.
A handful of commands obey read preferences; most are always sent to primary.
Track a 5-sample moving average of each replica set member's ping time.
Connection detects whether it's connected to primary, secondary, or mongos.
2012-07-25 00:05:06 -04:00
behackett
0ee7170cc2 It's 2012... 2012-04-19 12:40:38 -07:00
behackett
eacb277284 Update version added strings. 2011-08-05 14:22:32 -07:00
behackett
80d3d3856d Add a new uri_parser module PYTHON-243
This change moves the URI parsing code out
of pymongo.connection and into a new module,
pymongo.uri_parser. It also adds validation
for all MongoDB URI options currently supported
by pymongo as well as some that will be supported
in pymongo-2.0. an UnsupportedOption error
(inheriting from ConfigurationError) is raised
if the URI includes an option pymongo doesn't
support or recognize.

The primary entry point for uri_parser is
uri_parser.parse_uri which returns a dict of the
results from parsing the URI. See the documentation
for more details
2011-05-09 15:32:34 -07:00
Mike Dirolf
b0f9875c36 stop using InvalidName in bson package (replace with InvalidDocument) 2010-09-14 13:55:41 -04:00
Mike Dirolf
9c182809f3 Create a separate bson package PYTHON-60
Many of the pymongo modules have been moved into the bson
package. Aliases for those modules have been added to the pymongo
package, without deprecation warnings for now. Application developers
should begin to use the bson namespace, as deprecation of moved
modules will probably begin in the next release.
2010-09-14 13:52:50 -04:00
Mike Dirolf
a3a8cf2d79 BUMP 1.8 - see changelog for details 2010-08-05 10:04:37 -04:00
Mike Dirolf
159ebcc62d support for w, wtimeout, fsync, and any future getlasterror options 2010-08-03 11:24:24 -04:00
Mike Dirolf
9307c3d011 More flexible host parameter for Connection.
Can take a MongoDB URI (replaces Connection.from_uri) or a list of
hosts/URIs. In preparation for supporting replsets.
2010-07-12 11:24:46 -04:00
Mike Dirolf
a125034837 add code attribute to OperationFailure exceptions 2010-06-21 12:23:57 -04:00
jbergstroem
69a87923bb PEP8 fixes (only .py for now)
Signed-off-by: Mike Dirolf <mike@10gen.com>
2010-06-04 14:07:02 -04:00
Mike Dirolf
4817ba8770 BUMP 1.5 -- see changelog for details 2010-03-10 14:12:20 -05:00
Mike Dirolf
343eb506d7 adding Connection.from_uri to support the mongodb URI scheme 2010-02-10 13:29:46 -05:00
Mike Dirolf
0d82e561f7 minor: DuplicateKeyError only works for server version >= 1.3 - fix test for earlier versions 2010-01-31 17:24:44 -05:00
Mike Dirolf
3d7240e57f It's 2010! 2010-01-30 10:48:26 -05:00
Mike Dirolf
80537456c3 BUMP 1.4 - see changelog for details 2010-01-27 12:07:42 -05:00
Mike Dirolf
33de6b8d0d minor: PEP-8 2010-01-12 17:10:10 -05:00
Mike Dirolf
2307a7852b minor: doc 2010-01-12 16:52:08 -05:00
Mike Dirolf
c8e64f4c02 Use PyMongoError instead of BaseMongoDBException
Note that this is changing the exception hierarchy somewhat as well,
as I would rather not muck things up with multiple inheritance. This
is a breaking change if you depend on ConnectionFailure being an
IOError or InvalidBSON being a ValueError, for example. If this
creates issues for anybody please let us know and we can figure out a
better workaround.

Also add Michael to contributors list.
2010-01-12 16:47:50 -05:00
Michael Schurter
8e50ffb272 Added base exception class to all MongoDB exceptions 2010-01-13 05:37:06 +08:00
Mike Dirolf
aadf642fc0 minor: version info 2010-01-12 15:33:43 -05:00
Mike Dirolf
dd5237c113 adding DuplicateKeyError for safe inserts/updates 2010-01-12 12:29:33 -05:00
Mike Dirolf
54be5db873 removing all support for mongo-qa tests
allows us to remove SON.from_xml
  - not deprecating this as it was used internally only AFAIK

therefore eliminates driver dependency on elementtree
2010-01-05 14:20:12 -05:00
Mike Dirolf
7a8d2d2930 minor: doc 2009-12-01 13:30:54 -05:00
Mike Dirolf
1b395b0d53 minor: (DOC) clarify desired performance of auto-reconnect 2009-11-23 10:15:33 -05:00
Mike Dirolf
93e61c388b add InvalidStringData exception and speed up check for c extension string encoding 2009-08-28 16:38:27 -04:00
Mike Dirolf
090cba97a4 raise AutoReconnect instead of plain ConnectionFailure if we're going to try to reconnect 2009-07-06 11:02:42 -04:00
Mike Dirolf
b8b4a04442 PEP 8 - no functional changes 2009-06-05 16:19:49 -04:00
Mike Dirolf
9e94f219b3 starting work on pairing - will connect to master when given a pair. but doesn't handle auto-reconnection yet 2009-01-28 13:12:20 -05:00
Mike Dirolf
88a62b0c3e license 2009-01-22 15:10:00 -05:00
Mike Dirolf
d6c0ec39a3 create package pymongo and move all pymongo related modules there 2009-01-22 10:44:26 -05:00