Commit Graph

114 Commits

Author SHA1 Message Date
behackett
e0b52baf8e PYTHON-672 - Make read preference a class
This commit introduces the following changes:

- Each read preference is now a class.
- Read preferences other than Primary accept a tag_sets parameter.
- The tag_sets attribute of MongoClient, Database, and Collection has
  been removed. Use the tag_sets parameter of the new classes instead.
- The read_preferences.ReadPreference constant still exists and should
continue to work as expected for most users.
2014-04-14 16:28:07 -07:00
Bernie Hackett
2f86207246 PYTHON-526 secondaryAcceptableLatencyMS changes.
- Renamed to acceptableLatencyMS since it is also used
in choosing a new mongos during mongos HA failover.
- Moved to a global immutable setting. The expectation is
that the value would be determined by a network/system
admin. Changing it per operation doesn't make a lot of
sense.

Note - it's possible the name of this option may change again
before 3.0 is released.
2014-04-08 15:27:18 -07:00
behackett
de23b63994 PYTHON-526 Remove get/set/unset_lasterror_options
Use <object>.write_concern instead.
2014-04-05 12:27:38 -07:00
Bernie Hackett
37abda5e25 PYTHON-525 Remove MasterSlaveConnection
MongoDB master/slave clusters are deprecated. Use replica
sets instead. If you must use this client class the 2.x
branch of PyMongo will continue to be maintained for some
time.
2014-04-05 10:38:51 -07:00
Bernie Hackett
814434c1b2 PYTHON-526 Remove the network_timeout query option.
This was always a misguided feature. Using a socket timeout
to "timeout" MongoDB queries is awful for a few reasons:

- It leaves the query running on the server, wasting resources.
- It causes a socket to be closed and discarded unnecessarily.
- Applications that use this tend to immediately retry the query,
often causing another timeout and more wasted resources.

There are three remaining ways to use timeouts with PyMongo:

- connectTimeoutMS - Global setting for timing out a socket's
initial connection to the server.
- socketTimeoutMS - Global setting for timing out any socket
operation. *Do not* use this to enforce time limits on server
side operations.
- max_time_ms (or maxTimeoutMS as a command kwarg) - MongoDB 2.6
server side timebomb for queries and commands. This is a server
side option, passed along with a query or command, that causes
MongoDB to abort the operation if it takes longer than the specified
limit.
2014-04-05 09:59:38 -07:00
Bernie Hackett
85db128efd PYTHON-526 Remove the "safe" option.
Use w=0 for unacknowledged write operations.
2014-04-04 17:15:50 -07:00
Bernie Hackett
e08aa1f90d PYTHON-525 Remove (ReplicaSet)Connection.
Use MongoClient or MongoReplicaSetClient instead.
2014-04-04 16:56:25 -07:00
Bernie Hackett
48a65eb9c1 PYTHON-526 Drop support for slaveOk/slave_okay.
Use any ReadPreference other than PRIMARY instead.
2014-04-04 16:37:32 -07:00
Bernie Hackett
3ebb4b2eb2 Fix Collection.remove docs. 2014-03-19 13:19:07 -07:00
Bernie Hackett
26139557eb parallel_collection_scan -> parallel_scan PYTHON-633
Spec change. Also added better documentation with a
very basic example.
2014-02-13 09:16:53 -08:00
Bernie Hackett
940d73f672 Add parallel_collection_scan helper PYTHON-633
This commit adds a helper for the new parallelCollectionScan
command introduced in MongoDB 2.5.5. The helper returns
"num_cursors" instances of CommandCursor that can be iterated
by one or more threads concurrently to scan the entire collection.

This commit also removes the remaining command cursor
hacks from cursor.Cursor.
2014-02-11 13:04:53 -08:00
Bernie Hackett
cdacc2f4b9 Fix aggregate cursor read preference issues PYTHON-636
The cursor returned by aggregate now knows what server
it was created on, allowing it to return getMore results
when the read preference is not PRIMARY.

This also introduces a simplified cursor class for use
with commands that return a cursor id and perhaps an initial
set of results. None of the methods of cursor.Cursor (other
than batch_size) make sense in this case.
2014-02-10 18:55:50 -08:00
Bernie Hackett
1f6cd4fd7a Bulk API docs and examples PYTHON-630 2014-02-01 19:21:42 -08:00
Bernie Hackett
01f6361929 Fluent API for bulk write operations PYTHON-630 2014-01-21 11:47:09 -08:00
Bernie Hackett
f38e77a78f Fix max_pool_size class signature docs PYTHON-629 2014-01-17 14:38:18 -08:00
Kyle Erf
237754dbef PYTHON-310: Added find() method to gridfs
Allows iteration through arbitrary queries against the files collection using
a new GridOutCursor class.
2014-01-06 14:57:00 -08:00
A. Jesse Jiryu Davis
3757086e02 Raise ConfigurationError if a server's min wire version is > 2, PYTHON-587. 2013-12-14 12:57:09 -05:00
behackett
ce7ce38ffd Basic support for min and maxWireVersion PYTHON-587 2013-11-25 13:44:34 -08:00
A. Jesse Jiryu Davis
e4cf504559 Option to not compile BSON regexes. PYTHON-500
Add a 'compile_re' parameter to Collection.find, Collection.find_one, and
json_util.loads. If it's False, regular expressions are encoded as a new class,
Regex, instead of passed to re.compile(). This allows PyMongo to handle regular
expressions that don't compile in Python but are valid in other contexts like
MongoDB queries.
2013-10-20 17:18:32 -04:00
hawka
193628f9e4 updating docs 2013-08-30 15:51:50 -04:00
behackett
f804c8e16e Release notes and other doc fixes for 2.6. 2013-08-18 09:24:06 -07:00
behackett
4d42258697 Support exhaust cursor flag PYTHON-265 2013-08-05 11:29:11 -07:00
A. Jesse Jiryu Davis
75d0b85645 Add MongoClient.get_default_database(). PYTHON-461 2013-06-27 10:28:01 -07:00
Ross Lawley
cf9dca6970 Documentation clarifications PYTHON-486 / PYTHON-487 2013-03-13 15:11:16 +00:00
behackett
d2a286693e Add HASHED and GEOSPHERE index constants PYTHON-468 2013-02-22 12:43:48 -08:00
behackett
8de9051228 Remove MongoAuthenticationMechanism PYTHON-465
The spec changed - MongoAuthenticationMechanism is
no longer required.
2013-02-12 14:30:11 -08:00
A. Jesse Jiryu Davis
d2b23a535c Update docs for Connection->MongoClient change PYTHON-452 2013-02-10 10:53:35 -05:00
Bernie Hackett
554d1d9131 Add rst for the auth module. 2013-02-09 14:59:06 -08:00
behackett
676aef7a7c Remove TEXT constant PYTHON-456
The "text search" feature is experimental in
MongoDB 2.4 and the index type may change.
2013-01-22 17:08:50 -08:00
behackett
7603b9db79 Support "text" as an index specifier PYTHON-456
This also fixes a few documentation issues around
index types.
2013-01-04 10:44:16 -08:00
Bernie Hackett
034dba7f96 Minor doc fixes for Mongo(ReplicaSet)Client. 2012-11-16 17:25:36 -08:00
behackett
afe49a4002 MongoClient/MongoReplicaSetClient PYTHON-423
This change adds two new top level classes, MongoClient
and MongoReplicaSetClient. They work almost exactly the
same as Connection and ReplicaSetConnection with a few
differences:

1. These connection objects awknowledge write operations by default.
2. The network_timeout parameter is gone, use socketTimeoutMS instead.
3. auto_start_request defaults to False.

Default acknowledged write operation will be the biggest change for
most users. Using MongoClient and MongoReplicaSetClient you no longer
have to pass safe=True to a write method (save, update, insert, remove)
to request an acknowledgement from the server.

Connection and ReplicaSetConnection are now deprecated but retain their
previous behavior. This should not be a backward breaking change.
2012-11-16 13:39:18 -08:00
A. Jesse Jiryu Davis
eeb1ff8fde Implement alive() for Connection and RSC PYTHON-275 2012-11-10 22:32:44 -06:00
behackett
8dd2670182 New write concern API PYTHON-427
This change deprecates get|set|unset_lasterror_options,
replacing them with a write_concern attribute that can be
accessed directly. See the write_concern docstring for
an example of its use.
2012-11-06 14:44:46 -08:00
behackett
594a95740d Fix a few doc issues. 2012-11-05 14:57:32 -08:00
Bernie Hackett
37c1509e02 Validate keys during update replace ops PYTHON-410 2012-10-16 18:49:25 -07:00
A. Jesse Jiryu Davis
1da312ea43 Fix up read-preferences documentation 2012-10-05 18:28:15 -07:00
behackett
dfaadd53e8 Doc updates for PyMongo 2.3 2012-08-16 15:52:14 -07: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
Bernie Hackett
60188ad23e Add check_keys to save PYTHON-382 2012-07-22 15:42:29 -07:00
Ross Lawley
a5432ea0f3 Add helper for aggregate command PYTHON-366
Added collection helper method.
Created an aggregation example covering:
 * aggregate
 * map reduce
 * group
2012-07-12 09:43:55 +01:00
behackett
2b5289021f Deprecate cursor manager support PYTHON-323 2012-04-17 22:05:05 -04:00
Ross Lawley
097f13b58e PYTHON-317 Fixed typo in docs 2012-02-10 09:49:15 +00:00
behackett
1bbe1bd121 Minor doc fix. 2012-02-08 16:12:56 -08:00
Ross Lawley
8623d2f260 Updating docs - restoring removed methods. 2012-02-08 16:02:54 -08:00
Ross Lawley
3309c5f785 Deprecated connection.from_uri and connection.paired
Removed methods from docs
2012-02-08 15:58:09 -08:00
Ross Lawley
4a3c594080 Removed depreciated bson aliases
Updated the docs also.  Changed some sphinx syntax that was throwing
warnings.

Refs PYTHON-304
2012-01-17 15:41:30 +00:00
Bernie Hackett
e50844b273 Documentation fixes for read_preference. 2011-12-23 16:17:05 -08:00
behackett
a3a6bf3905 Initial crack at changelog for 2.1. 2011-12-06 11:15:30 -08:00
behackett
d06713c77f Deprecate slave_okay in favor of read_preference.
Read preference now defaults to PRIMARY. This same
change is coming to all the 10gen drivers.
2011-11-01 18:55:20 -07:00