Fix a number of doc test failures.

This commit is contained in:
Bernie Hackett 2012-11-16 18:40:42 -08:00
parent 1d2118e66c
commit fee292bcc1
4 changed files with 7 additions and 6 deletions

View File

@ -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

View File

@ -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):

View File

@ -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.

View File

@ -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('...')}]