Even with this change, "next" can raise StopIteration even though
"alive" is True. For example if batch size is 2 and there are 4
documents in the result set, then after the 4th document "alive" is True
but "next" raises StopIteration.
- 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.
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.
- 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.
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.
Using separate collections avoids an apparent race in mongos 2.6's
dropCollection, as well as clarifying the test. Further clarify it by
explicitly naming and specifying batches and the ids of documents within them.
- 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.
This change makes the codec_options, read_preference, and
write_concern attributes of MongoClient, Database, and
Collection read only. If you need to change any of these
options per-instance use MongoClient.get_database,
Database.get_collection, or Collection.with_options instead.
This change introduces a _command helper in the helpers
module, used by Database.command and various internal and
external command helpers instead of iterating a Cursor
instance.
This change also introduces a small incompatibility with
earier versions. The as_class and fields options have been
removed from Database.command. They were never documented
and only used by some internal helpers. This also removes
the documented uuid_subtype option. A forthcoming API
refactor will replace that functionality.