From fee292bcc12d4b6e2d4c9d1ff6f59fe59e0d0994 Mon Sep 17 00:00:00 2001 From: Bernie Hackett Date: Fri, 16 Nov 2012 18:40:42 -0800 Subject: [PATCH] Fix a number of doc test failures. --- doc/examples/aggregation.rst | 8 ++++---- doc/examples/geo.rst | 2 +- doc/tutorial.rst | 2 +- pymongo/collection.py | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/examples/aggregation.rst b/doc/examples/aggregation.rst index 63c109291..4639e94b4 100644 --- a/doc/examples/aggregation.rst +++ b/doc/examples/aggregation.rst @@ -7,9 +7,9 @@ group method. .. testsetup:: - >>> from pymongo import Connection - >>> connection = Connection() - >>> connection.drop_database('aggregation_example') + from pymongo import Connection + connection = Connection() + connection.drop_database('aggregation_example') Setup ----- @@ -59,7 +59,7 @@ eg "$sort": ... {"$sort": SON([("count", -1), ("_id", -1)])} ... ]) ... - {u'ok': 1.0, u'result': [{u'count': 3, u'_id': u'cat'}, {u'count': 2, u'_id': u'dog'}, {u'count': 1, u'_id': u'mouse'}, {u'count': 1, u'_id': None}]} + {u'ok': 1.0, u'result': [{u'count': 3, u'_id': u'cat'}, {u'count': 2, u'_id': u'dog'}, {u'count': 1, u'_id': u'mouse'}]} As well as simple aggregations the aggregation framework provides projection diff --git a/doc/examples/geo.rst b/doc/examples/geo.rst index 9522c4ed1..8469be1d4 100644 --- a/doc/examples/geo.rst +++ b/doc/examples/geo.rst @@ -67,8 +67,8 @@ It's also possible to query for all items within a given rectangle >>> for doc in db.places.find({"loc": {"$within": {"$box": [[2, 2], [5, 6]]}}}): ... repr(doc) ... - "{u'loc': [2, 5], u'_id': ObjectId('...')}" "{u'loc': [4, 4], u'_id': ObjectId('...')}" + "{u'loc': [2, 5], u'_id': ObjectId('...')}" Or circle (specified by center point and radius): diff --git a/doc/tutorial.rst b/doc/tutorial.rst index f6e4327e5..260818383 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -138,7 +138,7 @@ of the collections in our database: .. doctest:: >>> db.collection_names() - [u'posts', u'system.indexes'] + [u'system.indexes', u'posts'] .. note:: The *system.indexes* collection is a special internal collection that was created automatically. diff --git a/pymongo/collection.py b/pymongo/collection.py index 9c9d0b422..71e3ceb81 100644 --- a/pymongo/collection.py +++ b/pymongo/collection.py @@ -381,6 +381,7 @@ class Collection(common.BaseObject): >>> list(db.test.find()) [{u'a': u'b', u'x': u'y', u'_id': ObjectId('...')}] >>> db.test.update({"x": "y"}, {"$set": {"a": "c"}}) + {...} >>> list(db.test.find()) [{u'a': u'c', u'x': u'y', u'_id': ObjectId('...')}]