From 2bb4d67c12742e5f014e124bb0a7094d73e4dae9 Mon Sep 17 00:00:00 2001 From: Mike Dirolf Date: Thu, 17 Jun 2010 12:46:33 -0400 Subject: [PATCH] BUMP 1.7 - see changelog for details --- doc/api/pymongo/index.rst | 2 ++ doc/changelog.rst | 47 +++++++++++++++++++++++++++++++++++++ doc/examples/map_reduce.rst | 2 +- doc/faq.rst | 4 ++-- doc/tutorial.rst | 4 ++-- gridfs/errors.py | 2 +- pymongo/__init__.py | 2 +- pymongo/binary.py | 2 +- pymongo/bson.py | 4 ++-- pymongo/collection.py | 14 +++++------ pymongo/connection.py | 4 ++-- pymongo/cursor.py | 2 +- pymongo/max_key.py | 2 +- pymongo/min_key.py | 2 +- pymongo/timestamp.py | 2 +- setup.py | 2 +- 16 files changed, 73 insertions(+), 24 deletions(-) diff --git a/doc/api/pymongo/index.rst b/doc/api/pymongo/index.rst index 7b9075fa8..192d5bb31 100644 --- a/doc/api/pymongo/index.rst +++ b/doc/api/pymongo/index.rst @@ -31,5 +31,7 @@ Sub-modules: son son_manipulator timestamp + min_key + max_key json_util cursor_manager diff --git a/doc/changelog.rst b/doc/changelog.rst index f1ed48045..7eba391c8 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -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 `_. + +- 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 `_ 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 ---------------------- diff --git a/doc/examples/map_reduce.rst b/doc/examples/map_reduce.rst index 376ebe311..7eab33741 100644 --- a/doc/examples/map_reduce.rst +++ b/doc/examples/map_reduce.rst @@ -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: diff --git a/doc/faq.rst b/doc/faq.rst index 525cb188f..be6969e48 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -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. diff --git a/doc/tutorial.rst b/doc/tutorial.rst index 84ef9a722..8321549a2 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -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. diff --git a/gridfs/errors.py b/gridfs/errors.py index c292bb781..0c1c94146 100644 --- a/gridfs/errors.py +++ b/gridfs/errors.py @@ -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): diff --git a/pymongo/__init__.py b/pymongo/__init__.py index cd5221870..a0cc347b1 100644 --- a/pymongo/__init__.py +++ b/pymongo/__init__.py @@ -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 diff --git a/pymongo/binary.py b/pymongo/binary.py index 6a6b4003a..b31ef20f6 100644 --- a/pymongo/binary.py +++ b/pymongo/binary.py @@ -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 diff --git a/pymongo/bson.py b/pymongo/bson.py index 40cccb5cf..d26f0d015 100644 --- a/pymongo/bson.py +++ b/pymongo/bson.py @@ -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) diff --git a/pymongo/collection.py b/pymongo/collection.py index f0fdd540d..3a30809a8 100644 --- a/pymongo/collection.py +++ b/pymongo/collection.py @@ -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): diff --git a/pymongo/connection.py b/pymongo/connection.py index ab3938bbe..9f1e4589d 100644 --- a/pymongo/connection.py +++ b/pymongo/connection.py @@ -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): diff --git a/pymongo/cursor.py b/pymongo/cursor.py index 3d4d90eef..d0e3b1622 100644 --- a/pymongo/cursor.py +++ b/pymongo/cursor.py @@ -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 diff --git a/pymongo/max_key.py b/pymongo/max_key.py index be553a1e1..29f674909 100644 --- a/pymongo/max_key.py +++ b/pymongo/max_key.py @@ -14,7 +14,7 @@ """Representation for the MongoDB internal MaxKey type. -.. versionadded:: 1.6+ +.. versionadded:: 1.7 """ class MaxKey(object): diff --git a/pymongo/min_key.py b/pymongo/min_key.py index 09879cfbb..a4f37c57d 100644 --- a/pymongo/min_key.py +++ b/pymongo/min_key.py @@ -14,7 +14,7 @@ """Representation for the MongoDB internal MinKey type. -.. versionadded:: 1.6+ +.. versionadded:: 1.7 """ class MinKey(object): diff --git a/pymongo/timestamp.py b/pymongo/timestamp.py index c610029e7..58adda653 100644 --- a/pymongo/timestamp.py +++ b/pymongo/timestamp.py @@ -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): diff --git a/setup.py b/setup.py index d79769c05..df0433fc3 100755 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ from distutils.errors import DistutilsPlatformError, DistutilsExecError from distutils.core import Extension # Remember to change in pymongo/__init__.py as well! -version = "1.6+" +version = "1.7" f = open("README.rst") try: