BUMP 1.7 - see changelog for details
This commit is contained in:
parent
790f87be4a
commit
2bb4d67c12
@ -31,5 +31,7 @@ Sub-modules:
|
||||
son
|
||||
son_manipulator
|
||||
timestamp
|
||||
min_key
|
||||
max_key
|
||||
json_util
|
||||
cursor_manager
|
||||
|
||||
@ -1,6 +1,53 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
Changes in Version 1.7
|
||||
----------------------
|
||||
|
||||
Version 1.7 is a recommended upgrade for all PyMongo users. The full release notes are below, and some more in depth discussion of the highlights is `here <http://dirolf.com/2010/06/17/pymongo-1.7-released.html>`_.
|
||||
|
||||
- no longer attempt to build the C extension on big-endian systems.
|
||||
- added :class:`~pymongo.min_key.MinKey` and
|
||||
:class:`~pymongo.max_key.MaxKey`.
|
||||
- use unsigned for :class:`~pymongo.timestamp.Timestamp` in BSON
|
||||
encoder/decoder.
|
||||
- support ``True`` as ``"ok"`` in command responses, in addition to
|
||||
``1.0`` - necessary for server versions **>= 1.5.X**
|
||||
- BREAKING change to
|
||||
:meth:`~pymongo.collection.Collection.index_information` to add
|
||||
support for querying unique status and other index information.
|
||||
- added :attr:`~pymongo.connection.Connection.document_class`, to
|
||||
specify class for returned documents.
|
||||
- added `as_class` argument for
|
||||
:meth:`~pymongo.collection.Collection.find`, and in the BSON decoder.
|
||||
- added support for creating :class:`~pymongo.timestamp.Timestamp`
|
||||
instances using a :class:`~datetime.datetime`.
|
||||
- allow `dropTarget` argument for
|
||||
:class:`~pymongo.collection.Collection.rename`.
|
||||
- handle aware :class:`~datetime.datetime` instances, by converting to
|
||||
UTC.
|
||||
- added support for :class:`~pymongo.cursor.Cursor.max_scan`.
|
||||
- raise :class:`~gridfs.errors.FileExists` exception when creating a
|
||||
duplicate GridFS file.
|
||||
- use `y2038 <http://code.google.com/p/y2038/>`_ for time handling in
|
||||
the C extension - eliminates 2038 problems when extension is
|
||||
installed.
|
||||
- added `sort` parameter to
|
||||
:meth:`~pymongo.collection.Collection.find`
|
||||
- finalized deprecation of changes from versions **<= 1.4**
|
||||
- take any non-:class:`dict` as an ``"_id"`` query for
|
||||
:meth:`~pymongo.collection.Collection.find_one` or
|
||||
:meth:`~pymongo.collection.Collection.remove`
|
||||
- added ability to pass a :class:`dict` for `fields` argument to
|
||||
:meth:`~pymongo.collection.Collection.find` (supports ``"$slice"``
|
||||
and field negation)
|
||||
- simplified code to find master, since paired setups don't always have
|
||||
a remote
|
||||
- fixed bug in C encoder for certain invalid types (like
|
||||
:class:`~pymongo.collection.Collection` instances).
|
||||
- don't transparently map ``"filename"`` key to :attr:`name` attribute
|
||||
for GridFS.
|
||||
|
||||
Changes in Version 1.6
|
||||
----------------------
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@ PyMongo's API supports all of the features of MongoDB's map/reduce engine. One i
|
||||
.. doctest::
|
||||
|
||||
>>> db.things.map_reduce(map, reduce, full_response=True)
|
||||
{u'counts': {u'input': 4, u'emit': 6, u'output': 3}, u'timeMillis': ..., u'ok': 1.0, u'result': u'...'}
|
||||
{u'counts': {u'input': 4, u'emit': 6, u'output': 3}, u'timeMillis': ..., u'ok': True, u'result': u'...'}
|
||||
|
||||
All of the optional map/reduce parameters are also supported, simply pass them as keyword arguments. In this example we use the `query` parameter to limit the documents that will be mapped over:
|
||||
|
||||
|
||||
@ -108,9 +108,9 @@ about the decision, but here is a brief summary:
|
||||
What is the correct way to handle time zones with PyMongo?
|
||||
----------------------------------------------------------
|
||||
|
||||
Prior to PyMongo version 1.6+, the correct way is to only save naive
|
||||
Prior to PyMongo version 1.7, the correct way is to only save naive
|
||||
:class:`~datetime.datetime` instances, and to save all dates as
|
||||
UTC. In versions >= 1.6+, the driver will automatically convert aware
|
||||
UTC. In versions >= 1.7, the driver will automatically convert aware
|
||||
datetimes to UTC before saving them. All datetimes retrieved from the
|
||||
server (no matter what version of the driver you're using) will be
|
||||
naive and represent UTC.
|
||||
|
||||
@ -293,7 +293,7 @@ about how the query is being performed without the index:
|
||||
>>> posts.find({"date": {"$lt": d}}).sort("author").explain()["cursor"]
|
||||
u'BasicCursor'
|
||||
>>> posts.find({"date": {"$lt": d}}).sort("author").explain()["nscanned"]
|
||||
3.0
|
||||
3
|
||||
|
||||
We can see that the query is using the *BasicCursor* and scanning over
|
||||
all 3 documents in the collection. Now let's add a compound index and
|
||||
@ -307,7 +307,7 @@ look at the same information:
|
||||
>>> posts.find({"date": {"$lt": d}}).sort("author").explain()["cursor"]
|
||||
u'BtreeCursor date_-1_author_1'
|
||||
>>> posts.find({"date": {"$lt": d}}).sort("author").explain()["nscanned"]
|
||||
2.0
|
||||
2
|
||||
|
||||
Now the query is using a *BtreeCursor* (the index) and only scanning
|
||||
over the 2 matching documents.
|
||||
|
||||
@ -38,7 +38,7 @@ class NoFile(GridFSError):
|
||||
class FileExists(GridFSError):
|
||||
"""Raised when trying to create a file that already exists.
|
||||
|
||||
.. versionadded:: 1.6+
|
||||
.. versionadded:: 1.7
|
||||
"""
|
||||
|
||||
class UnsupportedAPI(GridFSError):
|
||||
|
||||
@ -39,7 +39,7 @@ ALL = 2
|
||||
"""Profile all operations."""
|
||||
|
||||
# Remember to change in setup.py as well!
|
||||
version = "1.6+"
|
||||
version = "1.7"
|
||||
"""Current version of PyMongo."""
|
||||
|
||||
Connection = PyMongo_Connection
|
||||
|
||||
@ -34,7 +34,7 @@ OLD_BINARY_SUBTYPE = 2
|
||||
|
||||
This is still the default subtype, but that is changing to :data:`BINARY_SUBTYPE`.
|
||||
|
||||
.. versionadded:: 1.6+
|
||||
.. versionadded:: 1.7
|
||||
"""
|
||||
|
||||
UUID_SUBTYPE = 3
|
||||
|
||||
@ -372,7 +372,7 @@ def _to_dicts(data, as_class=dict):
|
||||
- `as_class` (optional): the class to use for the resulting
|
||||
documents
|
||||
|
||||
.. versionadded:: 1.6+
|
||||
.. versionadded:: 1.7
|
||||
the `as_class` parameter
|
||||
"""
|
||||
docs = []
|
||||
@ -447,7 +447,7 @@ class BSON(str):
|
||||
- `as_class` (optional): the class to use for the resulting
|
||||
document
|
||||
|
||||
.. versionadded:: 1.6+
|
||||
.. versionadded:: 1.7
|
||||
the `as_class` parameter
|
||||
"""
|
||||
(document, _) = _bson_to_dict(self, as_class)
|
||||
|
||||
@ -338,7 +338,7 @@ class Collection(object):
|
||||
value of ``"_id"`` for the document to be removed
|
||||
- `safe` (optional): check that the remove succeeded?
|
||||
|
||||
.. versionchanged:: 1.6+
|
||||
.. versionchanged:: 1.7
|
||||
Accept any type other than a ``dict`` instance for removal
|
||||
by ``"_id"``, not just :class:`~pymongo.objectid.ObjectId`
|
||||
instances.
|
||||
@ -381,11 +381,11 @@ class Collection(object):
|
||||
- `**kwargs` (optional): any additional keyword arguments
|
||||
are the same as the arguments to :meth:`find`.
|
||||
|
||||
.. versionchanged:: 1.6+
|
||||
.. versionchanged:: 1.7
|
||||
Allow passing any of the arguments that are valid for
|
||||
:meth:`find`.
|
||||
|
||||
.. versionchanged:: 1.6+
|
||||
.. versionchanged:: 1.7
|
||||
Accept any type other than a ``dict`` instance as an
|
||||
``"_id"`` query, not just
|
||||
:class:`~pymongo.objectid.ObjectId` instances.
|
||||
@ -459,10 +459,10 @@ class Collection(object):
|
||||
.. note:: The `max_scan` parameter requires server
|
||||
version **>= 1.5.1**
|
||||
|
||||
.. versionadded:: 1.6+
|
||||
.. versionadded:: 1.7
|
||||
The `sort`, `max_scan` and `as_class` parameters.
|
||||
|
||||
.. versionchanged:: 1.6+
|
||||
.. versionchanged:: 1.7
|
||||
The `fields` parameter can now be a dict or any iterable in
|
||||
addition to a list.
|
||||
|
||||
@ -696,7 +696,7 @@ class Collection(object):
|
||||
u'x_1': {u'unique': True, u'key': [(u'x', 1)]}}
|
||||
|
||||
|
||||
.. versionchanged:: 1.6+
|
||||
.. versionchanged:: 1.7
|
||||
The values in the resultant dictionary are now dictionaries
|
||||
themselves, whose ``"key"`` item contains the list that was
|
||||
the value in previous versions of PyMongo.
|
||||
@ -797,7 +797,7 @@ class Collection(object):
|
||||
should be passed as keyword arguments
|
||||
(i.e. ``dropTarget=True``)
|
||||
|
||||
.. versionadded:: 1.6+
|
||||
.. versionadded:: 1.7
|
||||
support for accepting keyword arguments for rename options
|
||||
"""
|
||||
if not isinstance(new_name, basestring):
|
||||
|
||||
@ -135,7 +135,7 @@ class Connection(object): # TODO support auth for pooling
|
||||
documents returned from queries on this connection
|
||||
|
||||
.. seealso:: :meth:`end_request`
|
||||
.. versionadded:: 1.6+
|
||||
.. versionadded:: 1.7
|
||||
The `document_class` parameter.
|
||||
.. versionchanged:: 1.4
|
||||
DEPRECATED The `pool_size`, `auto_start_request`, and `timeout`
|
||||
@ -417,7 +417,7 @@ class Connection(object): # TODO support auth for pooling
|
||||
doc="""Default class to use for documents
|
||||
returned from queries on this connection.
|
||||
|
||||
.. versionadded:: 1.6+
|
||||
.. versionadded:: 1.7
|
||||
""")
|
||||
|
||||
def __find_master(self):
|
||||
|
||||
@ -303,7 +303,7 @@ class Cursor(object):
|
||||
|
||||
.. note:: Requires server version **>= 1.5.1**
|
||||
|
||||
.. versionadded:: 1.6+
|
||||
.. versionadded:: 1.7
|
||||
"""
|
||||
self.__check_okay_to_chain()
|
||||
self.__max_scan = max_scan
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
"""Representation for the MongoDB internal MaxKey type.
|
||||
|
||||
.. versionadded:: 1.6+
|
||||
.. versionadded:: 1.7
|
||||
"""
|
||||
|
||||
class MaxKey(object):
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
"""Representation for the MongoDB internal MinKey type.
|
||||
|
||||
.. versionadded:: 1.6+
|
||||
.. versionadded:: 1.7
|
||||
"""
|
||||
|
||||
class MinKey(object):
|
||||
|
||||
@ -43,7 +43,7 @@ class Timestamp(object):
|
||||
:class:`~datetime.datetime`
|
||||
- `inc`: the incrementing counter
|
||||
|
||||
.. versionchanged:: 1.6+
|
||||
.. versionchanged:: 1.7
|
||||
`time` can be a :class:`~datetime.datetime` instance
|
||||
"""
|
||||
if isinstance(time, datetime.datetime):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user