Commit Graph

67 Commits

Author SHA1 Message Date
Anthony Sottile
ff81fbb938 Ensure files end in a newline 2017-08-31 22:26:39 -07:00
Bernie Hackett
53bd24bfc3 PYTHON-1260 - Deprecate the group helper 2017-07-18 10:54:33 -07:00
Bernie Hackett
c6907bd40d PYTHON-1086 - Fix find_one documentation 2016-05-18 14:57:30 -07:00
Bernie Hackett
14ce3af058 PYTHON-861 - Implement list_indexes. 2015-03-16 08:00:58 -07:00
Bernie Hackett
9c4d01701b PYTHON-861 - Implement create_indexes. 2015-03-16 07:56:46 -07:00
Bernie Hackett
f93c73aa73 PYTHON-861 - create/ensure index changes
- Deprecate ensure_index
- Remove caching from create_index
- In create_index, remove support for the cache_for param, and the
  bucket_size and drop_dups aliases (they all remain in ensure_index)
- GridFS uses create_index
- Fix up tests.
2015-03-14 13:38:13 -07:00
Bernie Hackett
c60a4cd84b Fix ReturnDocument examples. 2015-03-05 11:45:00 -08:00
Bernie Hackett
d69f76d380 Finalize option locations and exports.
- Move ReturnDocument to pymongo.collection.
- Change ReturnDocument.Before to ReturnDocument.BEFORE
- Change ReturnDocument.After to ReturnDocument.AFTER
- Add pymongo.cursor.CursorType.
- Move pymongo.cursor.NON_TAILABLE and friends to attributes of CursorType.
- read_preferences.ReadPreference is once again an "enum".
- Fix docs for read_preferences.ReadPreference.
- Rename pymongo.options to pymongo.operations.
- Export CursorType, ReturnDocument, WriteConcern, and public classes
  from pymongo.opertions through pymongo/__init__.py
- Fix up a number of documentation issues in the process.
2015-03-05 11:35:46 -08:00
Bernie Hackett
b559ab0b46 PYTHON-835 - Consistent method signatures. 2015-02-24 13:44:16 -08:00
Bernie Hackett
839893939e PYTHON-821 - Deprecated legacy API.
This commit deprecates insert, update, save, and remove. Each
now raises DeprecationWarning at stacklevel 2. This change also
updates all tutorials and example documentation to use the new
CRUD API, tests the deprecations, and fixes up a few more tests
that were still using the legacy API.
2015-02-20 15:41:45 -08:00
Bernie Hackett
13f20bb45a PYTHON-821 - Add insert_many to built docs. 2015-02-12 18:02:06 -08:00
Bernie Hackett
4d6bdb1097 PYTHON-821 - Implement delete_one and delete_many. 2015-02-12 11:04:58 -08:00
Bernie Hackett
e7866dbd19 PYTHON-821 - Implement replace_one, update_one, and update_many. 2015-02-11 20:01:16 -08:00
Bernie Hackett
b9cd7b627b PYTHON-821 - Introduce results and options modules. 2015-02-11 13:52:51 -08:00
Bernie Hackett
df4e5269b3 PYTHON-821 - Implement insert_one. 2015-02-11 12:48:50 -08:00
Bernie Hackett
7416e6595c PYTHON-821 - Implement find_one_and_*.
This change also deprecates find_and_modify. Migrate
to find_one_and_delete, find_one_and_update, and/or
find_one_and_replace.
2015-02-10 12:09:47 -08:00
Bernie Hackett
be0ad8dec3 PYTHON-821 - Implement Collection.bulk_write. 2015-02-03 13:46:17 -08:00
behackett
c07e543e58 PYTHON-820 - API changes for find/find_one to comply with CRUD spec.
- Changed parameter names (default values and behaviors remain the same):
  - spec (spec_or_id in find_one) -> filter
  - fields -> projection
  - partial -> allow_partial_results

- The "timeout" option is renamed to "no_cursor_timeout" with its default
  changed to False.

- The tailable, await_data, and exhaust options will be replaced with a
  cursor_type option. Valid values:
  - cursor.NON_TAILABLE
  - cursor.TAILABLE
  - cursor.TAILABLE_AWAIT
  - cursor.EXHAUST

- The following options are added:
  - oplog_replay (bool - default False) - only valid with tailable cursors
    against the oplog.
  - modifiers (document - default None) - A dict of query modifiers. See
    http://docs.mongodb.org/manual/reference/operator/query-modifier/#modifiers for
    options.

- The following options are removed, replaced by the "modifiers" option:
  - max_scan
  - snapshot

- The as_class option is removed. Use Collection.with_options instead.
2015-01-19 22:10:56 -08:00
Bernie Hackett
f968f58ac6 PYTHON-805 - Fix docs for find() and Cursor. 2014-12-29 16:25:55 -08:00
Bernie Hackett
a3fb2462bb PYTHON-801 - Remove BaseObject.uuid_subtype 2014-12-29 07:34:07 -08:00
Bernie Hackett
f6a260c683 PYTHON-805 - Add with_options and remove per helper read_preference
This change removes the read_preference parameter from various
command helpers on the Collection object. Those options were
never shipped in a PyMongo release. It also documents which
helpers obey Collection.read_preference.

The bigger change is the removal of the read_preference, tag_sets,
and secondary_acceptable_latency_ms params from find() and find_one()
- a major backward breaking change. Collection.with_options
is intended to replace their use.

coll.find(read_preference=ReadPreference.SECONDARY)

changes to

coll.with_options(read_preference=ReadPreference.SECONDARY).find()
2014-12-17 15:06:03 -08:00
Bernie Hackett
550f25370e PYTHON-802 - Add get_database and get_collection methods 2014-12-15 11:01:29 -08:00
A. Jesse Jiryu Davis
2ba730722b PYTHON-526 Remove 'compile_re' option.
PyMongo now never attempts to compile BSON regular expressions as Python native
regular expressions.
2014-12-05 14:06:38 -05:00
Bernie Hackett
a1e05e1300 PYTHON-690 - Various fixes to indexing docstrings. 2014-05-01 10:18:42 -07:00
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
85db128efd PYTHON-526 Remove the "safe" option.
Use w=0 for unacknowledged write operations.
2014-04-04 17:15:50 -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
1f6cd4fd7a Bulk API docs and examples PYTHON-630 2014-02-01 19:21:42 -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
behackett
4d42258697 Support exhaust cursor flag PYTHON-265 2013-08-05 11:29:11 -07:00
behackett
d2a286693e Add HASHED and GEOSPHERE index constants PYTHON-468 2013-02-22 12:43:48 -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
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
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
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
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
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
Bernie Hackett
e50844b273 Documentation fixes for read_preference. 2011-12-23 16:17:05 -08:00